← pallets/flask

CODEFOSSIL · flask

send_file

function in src/flask/helpers.py:417 · Born 2010-05-10 (DERIVED, confidence 0.90)

16years old
67changes
10fixes
28authors
0callers

Copied here from flask.py; its history is followed back to where it was born.

20112012201320142015201620172018201920202021202220232024202520262010-07-04 d0c6ad7 Added support for conditional responses to send_file2010-07-04 532347d phased out shared data middleware in flask for send_file2010-07-04 2b00ec4 Small cleanups2010-07-04 b710986 Removed circular dependency by going over a proxy. This is the better solution anyway2010-07-13 85ff63c Emit correct date. In theory2010-08-07 fda1467 Deprecated send_file etag support and mimetype guessing for file-like objects. This fixes #1042010-11-08 858806d Hint for positioning file pointer correctly before calling send_file().2011-01-20 4a45345 Fix typo in send_file docs2011-02-05 0bf777e Do not use Date, use Last-Modified. This fixes #1642011-04-17 0ecc686 Fixed a typo2011-05-30 8017feb Don't fail for unicode filenames with send_file(add_etags=True)2012-03-13 d94efc6 Expose send_file max-age as config value, #433.2012-04-19 a3cb2a3 Use American English for "behavior" in docs.2012-04-24 26da6a5 Use default send_file max-age consistently.2012-06-13 4b21e2d I think it should check that cache_timeout is not None to allow for a (I hope legale) value of 0 for such parameter.2012-10-07 3bec75d Set the content-length header for sendfile. Fixes #4472012-10-07 301e244 Consistent use of encoding naming2013-05-21 e1d356f ported some more stuff to py 3.32013-05-30 47572c5 Set the content length automatically before calling wrap_file2013-05-30 9ae8487 Fixed a broekn testcase2014-02-08 2506c0b Fixed sending etags for file streams with a name. This fixes #930.2014-10-27 d4f6734 Remove a redundant "the" in a comment.2014-11-05 8284217 docs: ``True``, ``False`` and ``None``2014-11-05 17eee81 docs: ``Flask-Uploads``, ``X-Forwarded-Host``2015-02-07 29f7c10 Remove bad security advice about send_file.2015-06-06 8056921 Update send_file() docs to clarify encoding requirement #12862016-01-10 edb65cc remove 'flask' from etags to obscure server technologies2016-06-03 8458cc5 Remove deprecation warnings for add_etags & mimetype guessing for send_file()2016-06-05 af515cc Add last_modified arg for send_file2016-06-05 7c27140 pass value directly to last_modified2016-08-26 71e10be Properly remove f.name usage in send_file (#1988)2016-09-04 92ce20e Fix error in send_file helper (#2003)2016-09-10 a30951e Do not error for unknown files if send_file sends an actual file2016-09-11 1f0ca89 Killed now dead code2016-09-19 01081db Avoid always-false statement2016-09-26 7186a5a make use of range requests if available in werkzeug (#2031)2017-03-23 0049922 Fix send_file to work with non-ascii filenames2017-03-24 6ef45f3 Fix previous commits to work with python 2 and python 32017-03-30 bf023e7 Remove unidecode dependency and use unicodedata instead2017-04-07 d50a5db Keep using only filename if it's valid ascii2017-04-08 c197301 style cleanup break out header parts in test test for no filename* parameter for ascii header2017-04-12 09b4910 filename can be latin-1, not just ascii only normalize basic name when utf-8 header is needed ref #22232017-06-06 235c830 document inherited attributes for Flask and Blueprint closes #480 [ci skip]2017-11-24 c52e1b7 Fix ValueError for some invalid Range requests2018-02-06 af32ea0 bump dependency versions2018-04-18 49a38ed use theme provided by pallets-sphinx-themes2018-05-28 b51ab3f encode filenames as ascii instead of latin-1 latin-1 is allowed by pep3333, but that breaks gunicorn2019-01-05 25de45c Add support for PathLike objects in static file helpers2019-01-07 b570bf6 Allow partial content on bytesio2019-01-07 366f3f4 add changelog for GH-29572019-01-07 40118e7 Make sure the attachment filename is text type. If attachment filename is bytes type and contains non-ascii coded bytes, then the following ASCII encoding process will trigger UnicodeDecodeError exception.2019-05-06 025589e Reformat with black2019-06-01 53c893b fix string concats left over by black2019-11-19 980168d send_file doesn't allow StringIO2020-04-04 662c245 remove _compat module2020-04-04 57d628c remove more compat code2020-04-04 2ae740d f-strings everywhere2020-11-05 dc11cdb move send_file and send_from_directory to Werkzeug2021-01-29 14f5636 rename send_file add_etags to etag2021-04-15 8ab4967 consistent versions and deprecation messages2021-05-13 d5aadba improve type hints for send_file and send_from_directory2022-07-01 c2810ff remove deprecated send_file argument names2023-04-20 44ffe6c add __future__ annotations2023-08-16 04994df remove deprecated code2023-11-15 4104f29 type hint fix for flask.send_file2025-08-18 d44f1c6 relax type hint for bytes io2026-08-16 d318b68 explain seek2010-07-02 d0dc89e in with the new. i have the bits in places where i think they should be, now i just need to work on the import scheme layout2010-05-10 2d87e9b Added support for send_file
Every commit that changed it, 2010-05-10 – 2026-08-16. Raised orange dots are fixes.
  1. Changed explain seek

    d318b68 · David Lord

  2. Changed relax type hint for bytes io

    d44f1c6 · Tero Vuotila

  3. Changed type hint fix for flask.send_file

    4104f29 · Daniel Isaac

  4. Changed remove deprecated code

    04994df · David Lord

  5. Changed add __future__ annotations

    44ffe6c · David Lord

  6. Changed remove deprecated send_file argument names

    c2810ff · David Lord

  7. Changed improve type hints for send_file and send_from_directory

    d5aadba · Grey Li

  8. Changed consistent versions and deprecation messages

    8ab4967 · David Lord

  9. Changed rename send_file add_etags to etag

    14f5636 · David Lord

  10. Changed move send_file and send_from_directory to Werkzeug

    dc11cdb · David Lord

  11. Changed f-strings everywhere

    2ae740d · David Lord

  12. Changed remove more compat code

    57d628c · David Lord

  13. Changed remove _compat module

    662c245 · David Lord

  14. Changed send_file doesn't allow StringIO

    980168d · David Lord

  15. Changed fix string concats left over by black

    53c893b · David Lord fix · INFERRED

  16. Changed Reformat with black

    025589e · David Baumgold

  17. Changed Make sure the attachment filename is text type. If attachment filename is bytes type and contains non-ascii coded bytes, then the following ASCII encoding process will trigger UnicodeDecodeError exception.

    40118e7 · garenchan

  18. Changed add changelog for GH-2957

    366f3f4 · David Lord

  19. Changed Allow partial content on bytesio

    b570bf6 · Ignasi Bosch

  20. Changed Add support for PathLike objects in static file helpers

    25de45c · Matt Robenolt

  21. Changed encode filenames as ascii instead of latin-1 latin-1 is allowed by pep3333, but that breaks gunicorn

    b51ab3f · David Lord

  22. Changed use theme provided by pallets-sphinx-themes

    49a38ed · David Lord

  23. Changed bump dependency versions

    af32ea0 · David Lord

  24. Changed Fix ValueError for some invalid Range requests

    c52e1b7 · ThiefMaster fix · INFERRED

  25. Changed document inherited attributes for Flask and Blueprint closes #480 [ci skip]

    235c830 · David Lord

  26. Changed filename can be latin-1, not just ascii only normalize basic name when utf-8 header is needed ref #2223

    09b4910 · David Lord

  27. Changed style cleanup break out header parts in test test for no filename* parameter for ascii header

    c197301 · David Lord

  28. Changed Keep using only filename if it's valid ascii

    d50a5db · Antonio Larrosa

  29. Changed Remove unidecode dependency and use unicodedata instead

    bf023e7 · Antonio Larrosa

  30. Changed Fix previous commits to work with python 2 and python 3

    6ef45f3 · Antonio Larrosa fix · INFERRED

  31. Changed Fix send_file to work with non-ascii filenames

    0049922 · Antonio Larrosa fix · INFERRED

  32. Changed make use of range requests if available in werkzeug (#2031)

    7186a5a · Joël Charles

  33. Changed Avoid always-false statement

    01081db · Markus Unterwaditzer

  34. Changed Killed now dead code

    1f0ca89 · Armin Ronacher

  35. Changed Do not error for unknown files if send_file sends an actual file

    a30951e · Armin Ronacher

  36. Changed Fix error in send_file helper (#2003)

    92ce20e · Roman fix · INFERRED

  37. Changed Properly remove f.name usage in send_file (#1988)

    71e10be · Markus Unterwaditzer

  38. Changed pass value directly to last_modified

    7c27140 · David Lord

  39. Changed Add last_modified arg for send_file

    af515cc · Prachi Shirish Khadke

  40. Changed Remove deprecation warnings for add_etags & mimetype guessing for send_file()

    8458cc5 · Dan Sully

  41. Changed remove 'flask' from etags to obscure server technologies

    edb65cc · nivm

  42. Changed Update send_file() docs to clarify encoding requirement #1286

    8056921 · Keyan Pishdadian

  43. Changed Remove bad security advice about send_file.

    29f7c10 · Edward Z. Yang

  44. Changed docs: ``Flask-Uploads``, ``X-Forwarded-Host``

    17eee81 · defuz

  45. Changed docs: ``True``, ``False`` and ``None``

    8284217 · defuz

  46. Changed Remove a redundant "the" in a comment.

    d4f6734 · Petr Zemek

  47. Changed Fixed sending etags for file streams with a name. This fixes #930.

    2506c0b · Armin Ronacher fix · INFERRED

  48. Changed Fixed a broekn testcase

    9ae8487 · Armin Ronacher fix · INFERRED

  49. Changed Set the content length automatically before calling wrap_file

    47572c5 · Armin Ronacher

  50. Changed ported some more stuff to py 3.3

    e1d356f · Thomas Waldmann

  51. Changed Consistent use of encoding naming

    301e244 · Armin Ronacher

  52. Changed Set the content-length header for sendfile. Fixes #447

    3bec75d · Armin Ronacher fix · INFERRED

  53. Changed I think it should check that cache_timeout is not None to allow for a (I hope legale) value of 0 for such parameter.

    4b21e2d · Massimo Santini

  54. Changed Use default send_file max-age consistently.

    26da6a5 · Ron DuPlain

  55. Changed Use American English for "behavior" in docs.

    a3cb2a3 · Ron DuPlain

  56. Changed Expose send_file max-age as config value, #433.

    d94efc6 · Ron DuPlain

  57. Changed Don't fail for unicode filenames with send_file(add_etags=True)

    8017feb · Simon Sapin

  58. Changed Fixed a typo

    0ecc686 · Armin Ronacher

  59. Changed Do not use Date, use Last-Modified. This fixes #164

    0bf777e · Armin Ronacher fix · INFERRED

  60. Changed Fix typo in send_file docs

    4a45345 · Dag Odenhall

  61. Changed Hint for positioning file pointer correctly before calling send_file().

    858806d · Georg Brandl

  62. Changed Deprecated send_file etag support and mimetype guessing for file-like objects. This fixes #104

    fda1467 · Armin Ronacher fix · INFERRED

  63. Changed Emit correct date. In theory

    85ff63c · Armin Ronacher

  64. Changed Removed circular dependency by going over a proxy. This is the better solution anyway

    b710986 · Armin Ronacher

  65. Changed Small cleanups

    2b00ec4 · Armin Ronacher

  66. Changed phased out shared data middleware in flask for send_file

    532347d · Armin Ronacher

  67. Changed Added support for conditional responses to send_file

    d0c6ad7 · Armin Ronacher

  68. Moved here in with the new. i have the bits in places where i think they should be, now i just need to work on the import scheme layout

    d0dc89e · Justin Quick

  69. Born Added support for send_file

    2d87e9b · Armin Ronacher