Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 736fece

Browse filesBrowse files
author
Gauvain Pocentek
committed
Fix URL encoding on branch methods
Fixes python-gitlab#493
1 parent 86a8251 commit 736fece
Copy full SHA for 736fece

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Collapse file

‎gitlab/v4/objects.py‎

Copy file name to clipboardExpand all lines: gitlab/v4/objects.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,8 @@ def protect(self, developers_can_push=False, developers_can_merge=False,
882882
GitlabAuthenticationError: If authentication is not correct
883883
GitlabProtectError: If the branch could not be protected
884884
"""
885-
path = '%s/%s/protect' % (self.manager.path, self.get_id())
885+
id = self.get_id().replace('/', '%2F')
886+
path = '%s/%s/protect' % (self.manager.path, id)
886887
post_data = {'developers_can_push': developers_can_push,
887888
'developers_can_merge': developers_can_merge}
888889
self.manager.gitlab.http_put(path, post_data=post_data, **kwargs)
@@ -900,7 +901,8 @@ def unprotect(self, **kwargs):
900901
GitlabAuthenticationError: If authentication is not correct
901902
GitlabProtectError: If the branch could not be unprotected
902903
"""
903-
path = '%s/%s/unprotect' % (self.manager.path, self.get_id())
904+
id = self.get_id().replace('/', '%2F')
905+
path = '%s/%s/unprotect' % (self.manager.path, id)
904906
self.manager.gitlab.http_put(path, **kwargs)
905907
self._attrs['protected'] = False
906908

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.