From 13c2a53c0fe4ce1eeb156d6246ec82744ad77d68 Mon Sep 17 00:00:00 2001 From: Jonathan Rehm Date: Sat, 19 Aug 2017 08:32:00 -0700 Subject: [PATCH] Fix issues with Windows path separators --- cps/cache_buster.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cps/cache_buster.py b/cps/cache_buster.py index d6b7260d..6c390792 100644 --- a/cps/cache_buster.py +++ b/cps/cache_buster.py @@ -14,7 +14,7 @@ def init_cache_busting(app): because whenever the resource changes, so does its URL. """ - static_folder = app.static_folder # the rooted path to the static file folder + static_folder = os.path.join(app.static_folder, '') # path to the static file folder, with trailing slash hash_table = {} # map of file hashes @@ -28,7 +28,8 @@ def init_cache_busting(app): version = hashlib.md5(f.read()).hexdigest()[:7] # save version to tables - file_path = rooted_filename.replace(static_folder + "/", "") + file_path = rooted_filename.replace(static_folder, "") + file_path = file_path.replace("\\", "/") # Convert Windows path to web path hash_table[file_path] = version app.logger.debug('Finished computing cache-busting values')