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

This commit is contained in:
Armin Ronacher 2014-02-09 13:01:54 +00:00
parent d094d5b6fc
commit 76e2f9cd03
2 changed files with 4 additions and 0 deletions

View file

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