🐛 Ensure download directory
This commit is contained in:
1 parent
6132f481ce
commit
b3bc1e75aa
1 file changed
+3
-1
@@ -214,7 +214,9 @@ def download_file(url, folder, max_length=None):
|
||||
|
||||
# TODO check content-length against safety limit
|
||||
|
||||
path = os.path.join(folder, filename)
|
||||
path = os.path.abspath(os.path.join(folder, filename))
|
||||
assert path.startswith(folder)
|
||||
|
||||
with io.open(path, 'wb') as f:
|
||||
for chunk in r.iter_content(chunk_size=8192):
|
||||
f.write(chunk)
|
||||
|
||||
Reference in new issue
Block a user