1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
catborise
53240548a2
Merge pull request #477 from catborise/master
fix iso upload path error
2021-12-17 09:24:24 +03:00
catborise
9ddcd0e0f3 Merge branch 'master' of https://github.com/catborise/webvirtcloud 2021-12-17 09:22:12 +03:00
catborise
62d4cf88ba fix upload iso method 2021-12-17 09:21:42 +03:00

View file

@ -91,14 +91,16 @@ def storage(request, compute_id, pool):
"""
def handle_uploaded_file(path, f_name):
target = os.path.normpath(os.path.join(path, f_name))
target = os.path.normpath(os.path.join(path, str(f_name)))
if not target.startswith(path):
raise Exception("Security Issues with file uploading")
raise Exception(_("Security Issues with file uploading"))
destination = open(target, "wb+")
for chunk in f_name.chunks():
destination.write(chunk)
destination.close()
try:
with open(target, "wb+") as f:
for chunk in f_name.chunks():
f.write(chunk)
except FileNotFoundError:
messages.error(request, _("File not found. Check the path variable and filename"))
compute = get_object_or_404(Compute, pk=compute_id)
meta_prealloc = False