mirror of https://github.com/pallets/flask.git
Fixed send_from_directory not rebasing to the root path. This fixes #921
This commit is contained in:
parent
d094d5b6fc
commit
76e2f9cd03
2
CHANGES
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
|
||||
--------------
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue