No description
Find a file
Antonio Larrosa 0049922f2e Fix send_file to work with non-ascii filenames
This commit implements https://tools.ietf.org/html/rfc2231#section-4 in
order to support sending unicode characters. Tested on both Firefox and
Chromium under Linux.

This adds unidecode as a dependency, which might be relaxed by using
.encode('latin-1', 'ignore') but wouldn't be as useful.

Also, added a test for the correct headers to be added.

Previously, using a filename parameter to send_file with unicode characters, it
failed with the next error since HTTP headers don't allow non latin-1 characters.
Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 193, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 186, in execute
    write(b'')
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 152, in write
    self.send_header(key, value)
  File "/usr/lib64/python3.6/http/server.py", line 509, in send_header
    ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
UnicodeEncodeError: 'latin-1' codec can't encode character '\uff0f' in position 58: ordinal not in range(256)

Fixes #1286
2017-03-23 17:30:48 +01:00
.github Improve GitHub issue template 2016-06-02 23:27:41 +02:00
artwork Added lineart logo 2015-10-01 13:58:48 +02:00
docs Use print function in quickstart (#2204) 2017-03-13 13:58:24 +01:00
examples Migrate various docs links to https (#2180) 2017-02-11 10:43:11 +01:00
flask Fix send_file to work with non-ascii filenames 2017-03-23 17:30:48 +01:00
scripts Fix typos/grammar in docs (#2201) 2017-03-06 14:05:59 +01:00
tests Fix send_file to work with non-ascii filenames 2017-03-23 17:30:48 +01:00
.gitattributes Set merge strategy for CHANGES 2016-09-12 21:55:17 +03:00
.gitignore Adding coverage generation to tox (#2071) 2016-10-31 23:10:27 +01:00
.gitmodules use https instead of git protocol 2015-12-03 16:50:16 -08:00
.travis.yml Added python3.6 support for tests 2017-01-10 11:20:53 -06:00
AUTHORS Remove deprecation warnings for add_etags & mimetype guessing for send_file() 2016-06-03 14:52:33 +02:00
CHANGES Don't rely on X-Requested-With for pretty print json response (#2193) 2017-03-07 10:09:46 +09:00
CONTRIBUTING.rst Migrate various docs links to https (#2180) 2017-02-11 10:43:11 +01:00
LICENSE Happy New Year 2015 2015-01-02 11:35:00 +09:00
Makefile Use tox from make test 2016-11-02 17:56:59 +01:00
MANIFEST.in Update MANIFEST.in with simpler template commands 2016-02-19 08:23:28 -05:00
README py.test => pytest (#2173) 2017-02-09 18:34:16 +01:00
setup.cfg bdist_wheel replaces wheel (#2179) 2017-02-10 12:19:59 +01:00
setup.py Fix send_file to work with non-ascii filenames 2017-03-23 17:30:48 +01:00
test-requirements.txt Use tox from make test 2016-11-02 17:56:59 +01:00
tox.ini Fix send_file to work with non-ascii filenames 2017-03-23 17:30:48 +01:00


                          // Flask //

              web development, one drop at a time


    ~ What is Flask?

      Flask is a microframework for Python based on Werkzeug
      and Jinja2.  It's intended for getting started very quickly
      and was developed with best intentions in mind.

    ~ Is it ready?

      It's still not 1.0 but it's shaping up nicely and is
      already widely used.  Consider the API to slightly
      improve over time but we don't plan on breaking it.

    ~ What do I need?

      All dependencies are installed by using `pip install Flask`.
      We encourage you to use a virtualenv. Check the docs for
      complete installation and usage instructions.

    ~ Where are the docs?

      Go to http://flask.pocoo.org/docs/ for a prebuilt version
      of the current documentation.  Otherwise build them yourself
      from the sphinx sources in the docs folder.

    ~ Where are the tests?

      Good that you're asking.  The tests are in the
      tests/ folder.  To run the tests use the
      `pytest` testing tool:

        $ pytest

      Details on contributing can be found in CONTRIBUTING.rst

    ~ Where can I get help?

      Either use the #pocoo IRC channel on irc.freenode.net or
      ask on the mailinglist: http://flask.pocoo.org/mailinglist/

      See http://flask.pocoo.org/community/ for more resources.