From 1640a46fac313c389d790966562f58cba0bc7bd9 Mon Sep 17 00:00:00 2001 From: amercader Date: Thu, 28 Nov 2019 12:52:33 +0100 Subject: [PATCH] [#4801] Avoid using h.url_for_static when adding a public folder As at this point there isn't a Flask app context yet and we can't call the url_for function. But if I understand the code correctly we just want a link to the root of the site, taking into account stuff like root path settings etc --- ckan/plugins/toolkit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ckan/plugins/toolkit.py b/ckan/plugins/toolkit.py index 68e4e935cab..653e4690218 100644 --- a/ckan/plugins/toolkit.py +++ b/ckan/plugins/toolkit.py @@ -344,7 +344,8 @@ def _add_public_directory(cls, config, relative_path): relative_path, 'extra_public_paths' ) - add_public_path(path, h.url_for_static('/')) + url = h._local_url('/', locale='default') + add_public_path(path, url) @classmethod def _add_served_directory(cls, config, relative_path, config_var):