mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #21177 -- Made resolve_url support relative URLs.
This fixes redirecting to relative URLs with django.shortcuts.redirect.
This commit is contained in:
committed by
Tim Graham
parent
f3805f5c52
commit
e3d0790bd0
@@ -383,6 +383,10 @@ class RegexURLResolver(LocaleRegexProvider):
|
||||
text_args = [force_text(v) for v in args]
|
||||
text_kwargs = dict((k, force_text(v)) for (k, v) in kwargs.items())
|
||||
|
||||
if isinstance(lookup_view, six.string_types):
|
||||
# Handle relative URLs
|
||||
if any(lookup_view.startswith(path) for path in ('./', '../')):
|
||||
return lookup_view
|
||||
try:
|
||||
lookup_view = get_callable(lookup_view, True)
|
||||
except (ImportError, AttributeError) as e:
|
||||
|
||||
Reference in New Issue
Block a user