Fixed send_from_directory not rebasing to the root path. This fixes #921
This commit is contained in:
parent
d094d5b6fc
commit
76e2f9cd03
2 changed files with 4 additions and 0 deletions
2
CHANGES
2
CHANGES
|
|
@ -18,6 +18,8 @@ Version 0.10.2
|
||||||
the test client when absolute URLs were requested.
|
the test client when absolute URLs were requested.
|
||||||
- Made `@before_first_request` into a decorator as intended.
|
- Made `@before_first_request` into a decorator as intended.
|
||||||
- Fixed an etags bug when sending a file streams with a name.
|
- 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
|
Version 0.10.1
|
||||||
--------------
|
--------------
|
||||||
|
|
|
||||||
|
|
@ -615,6 +615,8 @@ def send_from_directory(directory, filename, **options):
|
||||||
forwarded to :func:`send_file`.
|
forwarded to :func:`send_file`.
|
||||||
"""
|
"""
|
||||||
filename = safe_join(directory, filename)
|
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):
|
if not os.path.isfile(filename):
|
||||||
raise NotFound()
|
raise NotFound()
|
||||||
options.setdefault('conditional', True)
|
options.setdefault('conditional', True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue