mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Merge pull request #319 from jangsutsr/7496_handle_empty_named_url_id_cornercase
Handle named URL processing corner case where identifier is empty string
This commit is contained in:
@@ -143,7 +143,8 @@ class URLModificationMiddleware(object):
|
|||||||
|
|
||||||
def _convert_named_url(self, url_path):
|
def _convert_named_url(self, url_path):
|
||||||
url_units = url_path.split('/')
|
url_units = url_path.split('/')
|
||||||
if len(url_units) < 6 or url_units[1] != 'api' or url_units[2] not in ['v2']:
|
# If the identifier is an empty string, it is always invalid.
|
||||||
|
if len(url_units) < 6 or url_units[1] != 'api' or url_units[2] not in ['v2'] or not url_units[4]:
|
||||||
return url_path
|
return url_path
|
||||||
resource = url_units[3]
|
resource = url_units[3]
|
||||||
if resource in settings.NAMED_URL_MAPPINGS:
|
if resource in settings.NAMED_URL_MAPPINGS:
|
||||||
|
|||||||
Reference in New Issue
Block a user