Skip to content

Commit 05656bb

Browse files
author
Gauvain Pocentek
committed
ProjectFile: handle / in path for delete() and save()
Fixes python-gitlab#326
1 parent 69f1045 commit 05656bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitlab/v4/objects.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ def save(self, branch, commit_message, **kwargs):
13601360
"""
13611361
self.branch = branch
13621362
self.commit_message = commit_message
1363+
self.file_path = self.file_path.replace('/', '%2F')
13631364
super(ProjectFile, self).save(**kwargs)
13641365

13651366
def delete(self, branch, commit_message, **kwargs):
@@ -1374,7 +1375,8 @@ def delete(self, branch, commit_message, **kwargs):
13741375
GitlabAuthenticationError: If authentication is not correct
13751376
GitlabDeleteError: If the server cannot perform the request
13761377
"""
1377-
self.manager.delete(self.get_id(), branch, commit_message, **kwargs)
1378+
file_path = self.get_id().replace('/', '%2F')
1379+
self.manager.delete(file_path, branch, commit_message, **kwargs)
13781380

13791381

13801382
class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin,

0 commit comments

Comments
 (0)