Commits

mitsuhiko  committed ff9bce2

fixed an URL generation bug that caused URLs to be invalid if a
generated component contains a colon.

  • Participants
  • Parent commits ca56654

Comments (0)

Files changed (3)

 
 - fixed an issue where the SharedDataMiddleware could cause an
   internal server error on weird paths when loading via pkg_resources.
+- fixed an URL generation bug that caused URLs to be invalid if a
+  generated component contains a colon.
 
 Version 0.6.2
 -------------

File tests/test_routing.py

     adapter = url_map.bind('example.org')
     assert adapter.match('/get', method='HEAD') == ('a', {})
     assert_raises(MethodNotAllowed, adapter.match, '/post', method='HEAD')
+
+
+def test_protocol_joining_bug():
+    m = Map([Rule('/<foo>', endpoint='x')])
+    a = m.bind('example.org')
+    assert a.build('x', {'foo': 'x:y'}) == '/x:y'
+    assert a.build('x', {'foo': 'x:y'}, force_external=True) == 'http://example.org/x:y'

File werkzeug/routing.py

         subdomain, path = rv
 
         if not force_external and subdomain == self.subdomain:
-            return str(urljoin(self.script_name, path.lstrip('/')))
+            return str(urljoin(self.script_name, './' + path.lstrip('/')))
         return str('%s://%s%s%s/%s' % (
             self.url_scheme,
             subdomain and subdomain + '.' or '',