From 05656bbe237707794e9dd1e75e453413c0cf25a5 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Fri, 29 Sep 2017 07:08:47 +0200 Subject: ProjectFile: handle / in path for delete() and save() Fixes #326 --- gitlab/v4/objects.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gitlab/v4/objects.py') diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index a7bad18..4bd5aad 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1360,6 +1360,7 @@ class ProjectFile(SaveMixin, ObjectDeleteMixin, RESTObject): """ self.branch = branch self.commit_message = commit_message + self.file_path = self.file_path.replace('/', '%2F') super(ProjectFile, self).save(**kwargs) def delete(self, branch, commit_message, **kwargs): @@ -1374,7 +1375,8 @@ class ProjectFile(SaveMixin, ObjectDeleteMixin, RESTObject): GitlabAuthenticationError: If authentication is not correct GitlabDeleteError: If the server cannot perform the request """ - self.manager.delete(self.get_id(), branch, commit_message, **kwargs) + file_path = self.get_id().replace('/', '%2F') + self.manager.delete(file_path, branch, commit_message, **kwargs) class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, -- cgit v1.2.1