Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
send_file doesn't urlencode ':/' in unicode attachment_filename #3074
When sending files with unicode filename (with
# -*- 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)
Some browsers (Chrome-based/Safari) ignore
This issue is about encoding colon and slash in attachment filename, not about filename/filename*.