You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/11/29 16:09:48 UTC
[airavata-django-portal-sdk] branch master updated: AIRAVATA-3542 Convert given filename, renames to valid filenames
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal-sdk.git
The following commit(s) were added to refs/heads/master by this push:
new c978cc8 AIRAVATA-3542 Convert given filename, renames to valid filenames
c978cc8 is described below
commit c978cc8b7962e9589b22fea7238bf4a5b7d819d0
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Nov 29 11:09:06 2021 -0500
AIRAVATA-3542 Convert given filename, renames to valid filenames
---
airavata_django_portal_sdk/views.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/airavata_django_portal_sdk/views.py b/airavata_django_portal_sdk/views.py
index d785aa7..37cc234 100644
--- a/airavata_django_portal_sdk/views.py
+++ b/airavata_django_portal_sdk/views.py
@@ -134,6 +134,7 @@ def download_experiments(request, download_id=None):
filename = download_spec.get("filename")
if filename is None:
filename = "experiments.zip"
+ filename = get_valid_filename(filename)
fp.seek(0)
# FileResponse will automatically close the temporary file
return FileResponse(fp, as_attachment=True, filename=filename)
@@ -186,6 +187,7 @@ def _matches_filters(filename, includes=None, excludes=None):
root, ext = os.path.splitext(filename)
template = Template(rename)
new_filename = template.safe_substitute(root=root, ext=ext)
+ new_filename = get_valid_filename(new_filename)
return True, new_filename
else:
return True, None