From 912b338f67f8f7a1d446112539224a93cf9e7945 Mon Sep 17 00:00:00 2001 From: Phil Schleihauf Date: Tue, 3 Dec 2013 16:00:50 -0500 Subject: [PATCH] expand relative directories in send_from_directory --- flask/helpers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flask/helpers.py b/flask/helpers.py index e59f7d3c..a4785ed4 100644 --- a/flask/helpers.py +++ b/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()