File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 22from mimetypes import guess_type
33from sh import convert
44from glob import glob
5- from urllib import pathname2url
5+ from urllib import pathname2url , quote
66from collections import defaultdict , OrderedDict
77from functools import wraps
88import EXIF , json , hmac , time
@@ -216,7 +216,12 @@ def getfileref():
216216@require_token ('filename' )
217217def fileget ():
218218 """Returns the file data of the file indicated by the query parameters."""
219- return static_file (resolve_file (), root = settings .BASE_DIR )
219+ r = static_file (resolve_file (), root = settings .BASE_DIR )
220+ download_name = request .query .downloadname
221+ if download_name :
222+ download_name = quote (path .basename (download_name ))
223+ r .set_header ('Content-Disposition' , "inline; filename*=utf-8''%s" % download_name )
224+ return r
220225
221226@route ('/fileupload' , method = 'OPTIONS' )
222227def fileupload_options ():
You can’t perform that action at this time.
0 commit comments