Skip to content

Commit 33d8d9b

Browse files
committed
Reverting the hash changes
1 parent cbb0212 commit 33d8d9b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

application/core/filters.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,11 @@ def hash_file(filename):
193193
print("File not found when creating a hash: " + filename)
194194
return ""
195195

196-
md5Hash = hashlib.new("md5", usedforsecurity=False)
197-
md5Hash.update(content)
198-
md5Hashed = md5Hash.hexdigest()
196+
sha1Hash = hashlib.sha1(content)
197+
sha1Hashed = sha1Hash.hexdigest()
199198

200199
# return the hex representation of digest
201-
return md5Hashed
200+
return sha1Hashed
202201

203202

204203
# Takes the URI and appends a param containing the current git hash

tests/unit/core/test_filters.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_cacheBust_no_params():
8686
assert input_uri == sections[0]
8787

8888
hash = sections[1].split("=")[1]
89-
assert len(hash) == 32
89+
assert len(hash) == 40
9090

9191

9292
def test_cacheBust_params():
@@ -99,7 +99,7 @@ def test_cacheBust_params():
9999
assert params[0] == "fakeParam=myFakeParam"
100100

101101
hash = params[1].split("=")[1]
102-
assert len(hash) == 32
102+
assert len(hash) == 40
103103

104104

105105
def test_append_uri_param():
@@ -120,7 +120,7 @@ def test_append_uri_param():
120120
def test_hash_file():
121121
result = hash_file("static/javascripts/MapController.js")
122122
print(result)
123-
assert len(result) == 32
123+
assert len(result) == 40
124124

125125

126126
def test_make_url_param_str_all_arguements():

0 commit comments

Comments
 (0)