Browse Source

expand relative directories in send_from_directory

pull/921/head
Phil Schleihauf 11 years ago
parent
commit
912b338f67
  1. 3
      flask/helpers.py

3
flask/helpers.py

@ -609,6 +609,9 @@ def send_from_directory(directory, filename, **options):
:param options: optional keyword arguments that are directly
forwarded to :func:`send_file`.
"""
# Expand relative directories to the app's root_path
if not os.path.isabs(directory):
directory = os.path.join(current_app.root_path, directory)
filename = safe_join(directory, filename)
if not os.path.isfile(filename):
raise NotFound()

Loading…
Cancel
Save