Skip to content

Commit 21e9519

Browse files
author
Mike Taylor
committed
Issue #3401 - Unbreak bust_cache
1 parent e6890e3 commit 21e9519

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

tests/unit/test_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_bust_cache_localhost():
139139

140140
def test_bust_cache_production_missing_file():
141141
"""Test for cache_bust the path is missing."""
142-
expected = '/punkcat/nowhere?missing_file'
142+
expected = 'punkcat/nowhere?missing_file'
143143
webcompat.app.config['LOCALHOST'] = None
144144
assert bust_cache('/punkcat/nowhere') == expected
145145

webcompat/templates/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def bust_cache(file_path):
3030
"""
3131
if app.config['LOCALHOST']:
3232
return file_path
33+
if file_path.startswith('/'):
34+
file_path = file_path[1:]
3335
absolute_path = os.path.join(STATIC_PATH, file_path)
3436
return file_path + '?' + get_checksum(absolute_path)
3537

@@ -41,6 +43,7 @@ def get_checksum(file_path):
4143
except KeyError:
4244
checksum = md5_checksum(file_path)
4345
cache_dict[str(file_path)] = checksum
46+
print('GET_CHECKSUM (after cache miss)', cache_dict)
4447
return checksum
4548

4649

0 commit comments

Comments
 (0)