Merge "REST API returns traceback fix"
This commit is contained in:
commit
fbf77a34ad
1
AUTHORS
1
AUTHORS
|
@ -8,6 +8,7 @@ Jon Maron <jmaron@hortonworks.com>
|
||||||
Matthew Farrellee <matt@redhat.com>
|
Matthew Farrellee <matt@redhat.com>
|
||||||
Nadya Privalova <nprivalova@mirantis.com>
|
Nadya Privalova <nprivalova@mirantis.com>
|
||||||
Nikita Konovalov <nkonovalov@mirantis.com>
|
Nikita Konovalov <nkonovalov@mirantis.com>
|
||||||
|
Nikolay Mahotkin <nmakhotkin@mirantis.com>
|
||||||
Ruslan Kamaldinov <rkamaldinov@mirantis.com>
|
Ruslan Kamaldinov <rkamaldinov@mirantis.com>
|
||||||
Sergey Lukjanov <slukjanov@mirantis.com>
|
Sergey Lukjanov <slukjanov@mirantis.com>
|
||||||
Sergey Reshetnyak <sreshetniak@mirantis.com>
|
Sergey Reshetnyak <sreshetniak@mirantis.com>
|
||||||
|
|
|
@ -47,11 +47,10 @@ class AuthValidator:
|
||||||
path = env['PATH_INFO']
|
path = env['PATH_INFO']
|
||||||
if path != '/':
|
if path != '/':
|
||||||
version, url_tenant, rest = commons.split_path(path, 3, 3, True)
|
version, url_tenant, rest = commons.split_path(path, 3, 3, True)
|
||||||
|
|
||||||
if not version or not url_tenant or not rest:
|
if not version or not url_tenant or not rest:
|
||||||
LOG.info("Incorrect path: %s", path)
|
LOG.info("Incorrect path: %s", path)
|
||||||
resp = ex.HTTPNotFound("Incorrect path")
|
resp = ex.HTTPNotFound("Incorrect path")
|
||||||
resp(env, start_response)
|
return resp(env, start_response)
|
||||||
|
|
||||||
if token_tenant != url_tenant:
|
if token_tenant != url_tenant:
|
||||||
LOG.debug("Unauthorized: token tenant != requested tenant")
|
LOG.debug("Unauthorized: token tenant != requested tenant")
|
||||||
|
|
|
@ -52,7 +52,7 @@ def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False):
|
||||||
count = len(segs)
|
count = len(segs)
|
||||||
if (segs[0] or count < minsegs or count > maxsegs or
|
if (segs[0] or count < minsegs or count > maxsegs or
|
||||||
'' in segs[1:minsegs]):
|
'' in segs[1:minsegs]):
|
||||||
raise ValueError('Invalid path: %s' % path)
|
return None, None, None
|
||||||
else:
|
else:
|
||||||
minsegs += 1
|
minsegs += 1
|
||||||
maxsegs += 1
|
maxsegs += 1
|
||||||
|
|
Loading…
Reference in New Issue