[viewvc-dev] svn_ra.py does not URI-escape spaces
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <63128076FD37044D8D8F78E3786805C11B48687B43__22003.1274752275$1209403464$gmane$org@PING.ad.priority-health.com> |
This causes an issue with a repository like the following: \Dir\Subdir\trunk \Dir\Subdir 2\trunk patch supplied ** ** ** PRIVILEGED AND CONFIDENTIAL ** ** ** This email transmission contains privileged and confidential information intended only for the use of the individual(s) or entity named above. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient or a person responsible for delivering this message to an intended recipient, please delete the email and immediately notify the sender via the email return address or mailto:[email protected]. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
svn_ra_escapeuri.patch
(application/octet-stream, 2.1 KB)
Index: /opt/subversion/viewvc/lib/vclib/svn/svn_ra.py
===================================================================
--- /opt/subversion/viewvc/lib/vclib/svn/svn_ra.py (revision 1873)
+++ /opt/subversion/viewvc/lib/vclib/svn/svn_ra.py (working copy)
@@ -33,6 +33,12 @@
return _datestr_to_date(ra.svn_ra_rev_prop(svnrepos.ra_session, rev,
core.SVN_PROP_REVISION_DATE))
+def uri_autoescape(uri):
+ # ported from Subversion: libsvn_subr/path.c svn_path_uri_autoescape()
+ for char in ' "<>\\^`{|}':
+ escval = '%%%02X' % ord(char)
+ uri = uri.replace(char, escval)
+ return uri
class LastHistoryCollector:
def __init__(self):
@@ -286,7 +292,7 @@
# Use ls3 to fetch the lock status for this item.
lockinfo = None
- dirents, locks = client.svn_client_ls3(dir_url, _rev2optrev(rev),
+ dirents, locks = client.svn_client_ls3(uri_autoescape(dir_url), _rev2optrev(rev),
_rev2optrev(rev), 0, self.ctx)
if locks.has_key(path_parts[-1]):
lockinfo = locks[path_parts[-1]].owner
@@ -319,7 +325,13 @@
def itemprops(self, path_parts, rev):
path = self._getpath(path_parts)
rev = self._getrev(rev)
- stream, fetched_rev, props = ra.svn_ra_get_dir(self.ra_session, path, rev)
+ try:
+ dirents, fetched_rev, props = ra.svn_ra_get_dir(self.ra_session,
+ path, rev)
+ except ValueError:
+ # older versions of the bindings didn't handle ra.svn_ra_get_dir()
+ # correctly.
+ props = ra.svn_ra_get_dir(self.ra_session, path, rev)
return props
def annotate(self, path_parts, rev):
@@ -390,7 +402,7 @@
dir_url = self.rootpath
dirents_locks = self._dirent_cache.get(key)
if not dirents_locks:
- dirents, locks = client.svn_client_ls3(dir_url, _rev2optrev(rev),
+ dirents, locks = client.svn_client_ls3(uri_autoescape(dir_url), _rev2optrev(rev),
_rev2optrev(rev), 0, self.ctx)
dirents_locks = [dirents, locks]
self._dirent_cache[key] = dirents_locks