mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-26 11:13:00 -03:00
use utf8 name too for file downloading
This commit is contained in:
parent
c5308efc57
commit
89043b8545
1 changed files with 6 additions and 1 deletions
|
@ -25,6 +25,7 @@ import mimetypes
|
||||||
import gzip
|
import gzip
|
||||||
from flask import Response, request, render_template, make_response
|
from flask import Response, request, render_template, make_response
|
||||||
from unidecode import unidecode
|
from unidecode import unidecode
|
||||||
|
from werkzeug.urls import url_quote
|
||||||
|
|
||||||
|
|
||||||
class SendBaseModeWeb:
|
class SendBaseModeWeb:
|
||||||
|
@ -263,7 +264,11 @@ class SendBaseModeWeb:
|
||||||
if use_gzip:
|
if use_gzip:
|
||||||
r.headers.set("Content-Encoding", "gzip")
|
r.headers.set("Content-Encoding", "gzip")
|
||||||
r.headers.set("Content-Length", filesize)
|
r.headers.set("Content-Length", filesize)
|
||||||
r.headers.set("Content-Disposition", "inline", filename=unidecode(basename))
|
filename_dict = {
|
||||||
|
'filename': unidecode(basename),
|
||||||
|
'filename*': "UTF-8''%s" % url_quote(basename)
|
||||||
|
}
|
||||||
|
r.headers.set("Content-Disposition", "inline", **filename_dict)
|
||||||
r = self.web.add_security_headers(r)
|
r = self.web.add_security_headers(r)
|
||||||
(content_type, _) = mimetypes.guess_type(basename, strict=False)
|
(content_type, _) = mimetypes.guess_type(basename, strict=False)
|
||||||
if content_type is not None:
|
if content_type is not None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue