Explorar o código

[raz] Check py version before unicode type check for non-ascii dir creation (#3162)

- Checking python version first and then the type of prefix if its unicode or not.
- This is required because python3 doesn't recognize unicode keyword, it is only done via python2.
- So checking the python version first will short-circuit the if condition because it will be False beforehand for py3 and type check of prefix for unicode will not happen.
Harsh Gupta %!s(int64=2) %!d(string=hai) anos
pai
achega
9675bc2f8c
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      desktop/core/src/desktop/lib/raz/raz_client.py

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

@@ -245,7 +245,7 @@ class RazClient(object):
     # In GET operations with non-ascii chars, only the non-ascii part is URL encoded.
     # We need to unquote the path fully before making a signed request for RAZ.
     if method == 'GET' and 'prefix' in url_params and '%' in url_params['prefix']:
-      if isinstance(url_params['prefix'], unicode) and sys.version_info[0] < 3:
+      if sys.version_info[0] < 3 and isinstance(url_params['prefix'], unicode):
         url_params['prefix'] = url_params['prefix'].encode()
 
       url_params['prefix'] = lib_urlunquote(url_params['prefix'])