Skip to content

Commit f436f39

Browse files
author
Célian Haydont
committed
sanitize path in requests
1 parent fff9f73 commit f436f39

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dataikuapi/dss/managedfolder.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from ..utils import DataikuUTF8CSVReader
33
from ..utils import DataikuStreamedHttpUTF8CSVReader
44
import json
5+
from requests import utils
56
from .metrics import ComputedMetrics
67
from .future import DSSFuture
78
from .discussion import DSSObjectDiscussions
@@ -81,25 +82,25 @@ def get_file(self, path):
8182
the file's content, as a stream
8283
"""
8384
return self.client._perform_raw(
84-
"GET", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, path))
85+
"GET", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)))
8586

8687
def delete_file(self, path):
8788
"""
8889
Delete a file from the managed folder
8990
"""
9091
return self.client._perform_empty(
91-
"DELETE", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, path))
92+
"DELETE", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)))
9293

9394
def put_file(self, path, f):
9495
"""
95-
Upload a file to the managed folder
96+
Upload the file to the managed folder
9697
9798
Args:
9899
f: the file contents, as a stream
99100
path: the path of the file
100101
"""
101102
return self.client._perform_json_upload(
102-
"POST", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, path),
103+
"POST", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)),
103104
path, f)
104105

105106
########################################################

0 commit comments

Comments
 (0)