This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch ranger-2.4
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.4 by this push:
     new 86afb44c6 RANGER-3969: Remove os.path.join causing incorrect windows 
path
86afb44c6 is described below

commit 86afb44c6751d860748c6f436121c3b811321603
Author: Dov Benyomin Sohacheski <[email protected]>
AuthorDate: Wed Nov 16 10:00:18 2022 +0200

    RANGER-3969: Remove os.path.join causing incorrect windows path
    
    Signed-off-by: Madhan Neethiraj <[email protected]>
    (cherry picked from commit 3efdceb957e2a37d8457619a0ec843e5eb0ddcca)
---
 intg/src/main/python/apache_ranger/client/ranger_client.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/intg/src/main/python/apache_ranger/client/ranger_client.py 
b/intg/src/main/python/apache_ranger/client/ranger_client.py
index 85f66a43e..7bb6493a1 100644
--- a/intg/src/main/python/apache_ranger/client/ranger_client.py
+++ b/intg/src/main/python/apache_ranger/client/ranger_client.py
@@ -19,7 +19,6 @@
 
 import json
 import logging
-import os
 from apache_ranger.exceptions                 import RangerServiceException
 from apache_ranger.model.ranger_base          import RangerBase
 from apache_ranger.model.ranger_policy        import RangerPolicy
@@ -31,6 +30,7 @@ from apache_ranger.model.ranger_service_tags  import 
RangerServiceTags
 from apache_ranger.utils                      import *
 from requests                                 import Session
 from requests                                 import Response
+from urllib.parse                             import urljoin
 
 LOG = logging.getLogger(__name__)
 
@@ -402,7 +402,7 @@ class RESTResponse(RangerBase):
 
 class RangerClientHttp:
     def __init__(self, url, auth):
-        self.url          = url
+        self.url          = url.rstrip('/')
         self.session      = Session()
         self.session.auth = auth
 
@@ -417,7 +417,7 @@ class RangerClientHttp:
         if request_data:
             params['data'] = json.dumps(request_data)
 
-        path = os.path.join(self.url, api.path)
+        path = urljoin(self.url, api.path.lstrip('/'))
 
         if LOG.isEnabledFor(logging.DEBUG):
             LOG.debug("------------------------------------------------------")

Reply via email to