Browse Source

[raz] Do not get confusing error message on no value arguments

Romain Rigaux 4 years ago
parent
commit
39a91c6022

+ 2 - 2
desktop/core/src/desktop/lib/raz/raz_client.py

@@ -86,7 +86,7 @@ class RazClient(object):
     LOG.debug("Check access: method {%s}, url {%s}, params {%s}, headers {%s}" % (method, url, params, headers))
 
     path = lib_urlparse(url)
-    url_params = dict([p.split('=') for p in path.query.split('&') if path.query])
+    url_params = dict([p.split('=') if '=' in p else (p, '') for p in path.query.split('&') if path.query])  # ?delete, ?prefix=/hue
     params = params if params is not None else {}
     headers = headers if headers is not None else {}
 
@@ -97,7 +97,7 @@ class RazClient(object):
     resource_path = path.path.lstrip("/")
 
     LOG.debug(
-      "Preparing sign request with http_method: {%s}, header: {%s}, parameters: {%s}, endpoint: {%s}, resource_path: {%s}" %
+      "Preparing sign request with http_method: {%s}, headers: {%s}, parameters: {%s}, endpoint: {%s}, resource_path: {%s}" %
       (method, headers, allparams, endpoint, resource_path)
     )
     raz_req = raz_signer.SignRequestProto(

+ 4 - 4
desktop/libs/aws/src/aws/s3/s3connection.py

@@ -127,11 +127,11 @@ class RazS3Connection(SignedUrlS3Connection):
 
     url = 'https://%(host)s%(path)s' % {'host': host, 'path': path}
 
-    headers = self.get_signed_url(action=method, url=url, headers=headers)
-    LOG.debug('Raz returned those headers: %s' % headers)
+    raz_headers = self.get_signed_url(action=method, url=url, headers=headers)
+    LOG.debug('Raz returned those headers: %s' % raz_headers)
 
-    if headers is not None:
-      http_request.headers.update(headers)
+    if raz_headers is not None:
+      http_request.headers.update(raz_headers)
     else:
       LOG.error('We got back empty header from Raz for the request %s' % http_request)