-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Closed
Milestone
Description
Expected Behavior
When sending files with unicode filename (with : or /) they should be downloaded with name from filename* field.
# -*- coding: utf-8 -*-
import os
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/test/', methods=['GET'])
def test_route():
tmp_dir = os.getcwd()
tmp_filename = __file__
attachment_filename = u'тест:тест_тест.py'
return send_from_directory(
tmp_dir,
tmp_filename,
as_attachment=True,
attachment_filename=attachment_filename
)
if __name__ == '__main__':
app.run(host='::', port=5000)Actual Behavior
Some browsers (Chrome-based/Safari) ignore filename* field when it contains colon or slash. For example file тест:тест_тест.py gets downloaded in Chrome/Safari as __.py but in Firefox as тест_тест_тест.py which is acceptable in my opinion.
Flask response:
Content-Disposition: attachment; filename*="UTF-8''%D1%82%D0%B5%D1%81%D1%82:%D1%82%D0%B5%D1%81%D1%82_%D1%82%D0%B5%D1%81%D1%82.py"; filename=":_.py"
Environment
- Python version: 2.7.15
- Flask version: 1.0.2
- Werkzeug version: 0.14.1
Metadata
Metadata
Assignees
Labels
No labels