Commit 0f24974b by Arjun Singh

Stripping off trailing slashes rather than hacking them into the regex

parent b66a4448
...@@ -19,7 +19,7 @@ URL_RE = re.compile(""" ...@@ -19,7 +19,7 @@ URL_RE = re.compile("""
(?P<org>[^/]+)/ (?P<org>[^/]+)/
(?P<course>[^/]+)/ (?P<course>[^/]+)/
(?P<category>[^/]+)/ (?P<category>[^/]+)/
(?P<name>[^@/]+) (?P<name>[^@]+)
(@(?P<revision>[^/]+))? (@(?P<revision>[^/]+))?
""", re.VERBOSE) """, re.VERBOSE)
...@@ -138,6 +138,8 @@ class Location(_LocationBase): ...@@ -138,6 +138,8 @@ class Location(_LocationBase):
check(list_[4], INVALID_CHARS_NAME) check(list_[4], INVALID_CHARS_NAME)
if isinstance(location, basestring): if isinstance(location, basestring):
if location.endswith('/'):
location = location[:-1]
match = URL_RE.match(location) match = URL_RE.match(location)
if match is None: if match is None:
log.debug('location is instance of %s but no URL match' % basestring) log.debug('location is instance of %s but no URL match' % basestring)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment