diff options
| author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-10 14:48:03 +0200 |
|---|---|---|
| committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-10 14:48:07 +0200 |
| commit | 736fece2219658ff446ea31ee3c03dfe18ecaacb (patch) | |
| tree | 7be7f9f1852128ca03c4d1ac85e033c215fa9e40 /gitlab/v4/objects.py | |
| parent | 86a825143fdae82d231c2c3589d81b26c8c3ab81 (diff) | |
| download | gitlab-736fece2219658ff446ea31ee3c03dfe18ecaacb.tar.gz | |
Fix URL encoding on branch methods
Fixes #493
Diffstat (limited to 'gitlab/v4/objects.py')
| -rw-r--r-- | gitlab/v4/objects.py | 6 |
1 files 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 |
