2020from gitlab import cli
2121from gitlab import exceptions as exc
2222from gitlab import types as g_types
23+ from gitlab import utils
2324
2425
2526class GetMixin (object ):
@@ -42,7 +43,7 @@ def get(self, id, lazy=False, **kwargs):
4243 GitlabGetError: If the server cannot perform the request
4344 """
4445 if not isinstance (id , int ):
45- id = id . replace ( "/" , "%2F" )
46+ id = utils . clean_str_id ( id )
4647 path = "%s/%s" % (self .path , id )
4748 if lazy is True :
4849 return self ._obj_cls (self , {self ._obj_cls ._id_attr : id })
@@ -299,7 +300,7 @@ def set(self, key, value, **kwargs):
299300 Returns:
300301 obj: The created/updated attribute
301302 """
302- path = "%s/%s" % (self .path , key . replace ( "/" , "%2F" ))
303+ path = "%s/%s" % (self .path , utils . clean_str_id ( key ))
303304 data = {"value" : value }
304305 server_data = self .gitlab .http_put (path , post_data = data , ** kwargs )
305306 return self ._obj_cls (self , server_data )
@@ -322,7 +323,7 @@ def delete(self, id, **kwargs):
322323 path = self .path
323324 else :
324325 if not isinstance (id , int ):
325- id = id . replace ( "/" , "%2F" )
326+ id = utils . clean_str_id ( id )
326327 path = "%s/%s" % (self .path , id )
327328 self .gitlab .http_delete (path , ** kwargs )
328329
0 commit comments