You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/01/31 16:11:49 UTC

[allura] branch master updated (47c5a44 -> 1ae2785)

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git.


    from 47c5a44  [#8333] Bump timermiddleware version
     new be453d4  [#8333] unicode fixes for tarball snapshots
     new 1ae2785  [#8333] better unicode fix for side-by-side diffs

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Allura/allura/controllers/repository.py | 4 ++--
 Allura/allura/lib/diff.py               | 2 +-
 Allura/allura/model/repository.py       | 4 ++--
 Allura/allura/tests/unit/test_repo.py   | 2 +-
 ForgeSVN/forgesvn/model/svn.py          | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)


[allura] 02/02: [#8333] better unicode fix for side-by-side diffs

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 1ae27859e9448ed74cc6bdcb3c7e2e9bc4e80b92
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Fri Jan 31 11:11:20 2020 -0500

    [#8333] better unicode fix for side-by-side diffs
---
 Allura/allura/lib/diff.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Allura/allura/lib/diff.py b/Allura/allura/lib/diff.py
index ae46742..b3c82e0 100644
--- a/Allura/allura/lib/diff.py
+++ b/Allura/allura/lib/diff.py
@@ -58,7 +58,7 @@ class HtmlSideBySideDiff(object):
     def _preprocess(self, line):
         if not line:
             return line
-        line = six.ensure_text(line).expandtabs(self._tabsize)
+        line = h.really_unicode(line).expandtabs(self._tabsize)
         return line.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
 
     def _replace_marks(self, line):


[allura] 01/02: [#8333] unicode fixes for tarball snapshots

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit be453d4bb30cf75aec14bfa30b9ebf94272b94ad
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Fri Jan 31 10:42:54 2020 -0500

    [#8333] unicode fixes for tarball snapshots
---
 Allura/allura/controllers/repository.py | 4 ++--
 Allura/allura/model/repository.py       | 4 ++--
 Allura/allura/tests/unit/test_repo.py   | 2 +-
 ForgeSVN/forgesvn/model/svn.py          | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 225ea97..7437df3 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -717,7 +717,7 @@ class CommitBrowser(BaseController):
         status = c.app.repo.get_tarball_status(rev, path)
         if not status and request.method == 'POST':
             allura.tasks.repo_tasks.tarball.post(rev, path)
-            redirect(('tarball' + u'?path={0}'.format(path) if path else '').encode('utf-8'))
+            redirect('tarball?path={0}'.format(h.urlquote(path) if path else ''))
         return dict(commit=self._commit, revision=rev, status=status)
 
     @expose('json:')
@@ -777,7 +777,7 @@ class TreeBrowser(BaseController, DispatchIndex):
         tool_subscribed = M.Mailbox.subscribed()
         tarball_url = None
         if asbool(tg.config.get('scm.repos.tarball.enable', False)):
-            cutout = len('tree' + self._path.encode('utf8'))
+            cutout = len(b'tree' + self._path.encode('utf8'))
             if request.path.endswith('/') and not self._path.endswith('/'):
                 cutout += 1
             tarball_url = h.urlquote('%starball' % unquote(request.path)[:-cutout])
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 5507356..d4708d1 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -430,7 +430,7 @@ class Repository(Artifact, ActivityObject):
         pathname = os.path.join(
             self.tarball_path, self.tarball_filename(revision, path))
         filename = '%s%s' % (pathname, '.zip')
-        if os.path.isfile(filename):
+        if os.path.isfile(filename.encode('utf-8')):
             return 'complete'
 
         # file doesn't exist, check for busy task
@@ -1938,7 +1938,7 @@ def zipdir(source, zipfile, exclude=None):
     # this is needed to get proper prefixes inside zip-file
     working_dir = os.path.dirname(source)
     source_fn = os.path.basename(source)
-    command = [zipbin, '-y', '-q', '-r', zipfile, source_fn]
+    command = [zipbin, '-y', '-q', '-r', zipfile, source_fn.encode('utf-8')]
     if exclude:
         command += ['-x', exclude]
     p = Popen(command, cwd=working_dir, stdout=PIPE, stderr=PIPE)
diff --git a/Allura/allura/tests/unit/test_repo.py b/Allura/allura/tests/unit/test_repo.py
index 83827e5..792d5e5 100644
--- a/Allura/allura/tests/unit/test_repo.py
+++ b/Allura/allura/tests/unit/test_repo.py
@@ -281,7 +281,7 @@ class TestZipDir(unittest.TestCase):
         self.assertIn(
             "Command: " +
             ("['/bin/zip', '-y', '-q', '-r', '/fake/zip/file.tmp', 'repo'] " if six.PY3 else
-             "[u'/bin/zip', u'-y', u'-q', u'-r', u'/fake/zip/file.tmp', u'repo'] ") +
+             "[u'/bin/zip', u'-y', u'-q', u'-r', u'/fake/zip/file.tmp', 'repo'] ") +
             "returned non-zero exit code 1", emsg)
         self.assertTrue("STDOUT: 1" in emsg)
         self.assertTrue("STDERR: 2" in emsg)
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index b8c835c..4f7560a 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -695,8 +695,8 @@ class SVNImplementation(M.RepositoryImplementation):
         archive_name = self._repo.tarball_filename(commit, path)
         dest = os.path.join(self._repo.tarball_path, archive_name)
         tmpdest = os.path.join(self._repo.tarball_tmpdir, archive_name)
-        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.zip'))
-        tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
+        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.zip')).encode('utf-8')
+        tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp')).encode('utf-8')
         rmtree(dest.encode('utf8'), ignore_errors=True)  # must encode into bytes or it'll fail on non-ascii filenames
         rmtree(tmpdest.encode('utf8'), ignore_errors=True)
         path = os.path.join(self._url, path)