From 6382d1dbf5bd4e1fc7763d5f58e4d87f986bf720 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Thu, 10 Sep 2015 20:46:18 +0200 Subject: [PATCH] Fix for hash_file_path when not starting with forward slash --- pillar/application/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pillar/application/utils.py b/pillar/application/utils.py index 783d5a7d..820ebb2d 100644 --- a/pillar/application/utils.py +++ b/pillar/application/utils.py @@ -3,6 +3,8 @@ from hashlib import md5 from application import app def hash_file_path(file_path, expiry_timestamp=None): + if not file_path.startswith('/'): + file_path = '/' + file_path; service_domain = app.config['CDN_SERVICE_DOMAIN'] domain_subfolder = app.config['CDN_CONTENT_SUBFOLDER'] asset_url = app.config['CDN_SERVICE_DOMAIN_PROTOCOL'] + \ @@ -14,9 +16,6 @@ def hash_file_path(file_path, expiry_timestamp=None): if app.config['CDN_USE_URL_SIGNING']: url_signing_key = app.config['CDN_URL_SIGNING_KEY'] - if not file_path.startswith('/'): - file_path = '/' + file_path; - hash_string = domain_subfolder + file_path + url_signing_key; if not expiry_timestamp: