From 736fece2219658ff446ea31ee3c03dfe18ecaacb Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Thu, 10 May 2018 14:48:03 +0200 Subject: Fix URL encoding on branch methods Fixes #493 --- gitlab/v4/objects.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 956038b..758b1fa 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -882,7 +882,8 @@ class ProjectBranch(ObjectDeleteMixin, RESTObject): GitlabAuthenticationError: If authentication is not correct GitlabProtectError: If the branch could not be protected """ - path = '%s/%s/protect' % (self.manager.path, self.get_id()) + id = self.get_id().replace('/', '%2F') + path = '%s/%s/protect' % (self.manager.path, id) post_data = {'developers_can_push': developers_can_push, 'developers_can_merge': developers_can_merge} self.manager.gitlab.http_put(path, post_data=post_data, **kwargs) @@ -900,7 +901,8 @@ class ProjectBranch(ObjectDeleteMixin, RESTObject): GitlabAuthenticationError: If authentication is not correct GitlabProtectError: If the branch could not be unprotected """ - path = '%s/%s/unprotect' % (self.manager.path, self.get_id()) + id = self.get_id().replace('/', '%2F') + path = '%s/%s/unprotect' % (self.manager.path, id) self.manager.gitlab.http_put(path, **kwargs) self._attrs['protected'] = False -- cgit v1.2.1