Browse Source

Fixed send_from_directory not rebasing to the root path. This fixes #921

pull/1208/head
Armin Ronacher 11 years ago
parent
commit
76e2f9cd03
  1. 2
      CHANGES
  2. 2
      flask/helpers.py

2
CHANGES

@ -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
--------------

2
flask/helpers.py

@ -615,6 +615,8 @@ def send_from_directory(directory, filename, **options):
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)

Loading…
Cancel
Save