Skip to content

Commit

Permalink
Fixed send_from_directory not rebasing to the root path. This fixes p…
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Feb 9, 2014
1 parent d094d5b commit 76e2f9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -18,6 +18,8 @@ Version 0.10.2
the test client when absolute URLs were requested.
- Made `@before_first_request` into a decorator as intended.
- Fixed an etags bug when sending a file streams with a name.
- Fixed `send_from_directory` not expanding to the application root path
correctly.

Version 0.10.1
--------------
Expand Down
2 changes: 2 additions & 0 deletions flask/helpers.py
Expand Up @@ -615,6 +615,8 @@ def download_file(filename):
forwarded to :func:`send_file`.
"""
filename = safe_join(directory, filename)
if not os.path.isabs(filename):
filename = os.path.join(current_app.root_path, filename)
if not os.path.isfile(filename):
raise NotFound()
options.setdefault('conditional', True)
Expand Down

0 comments on commit 76e2f9c

Please sign in to comment.