Page MenuHomeSoftware Heritage

No OneTemporary

diff --git a/swh/web/ui/query.py b/swh/web/ui/query.py
index ee5fc1d53..e2377bd76 100644
--- a/swh/web/ui/query.py
+++ b/swh/web/ui/query.py
@@ -1,40 +1,40 @@
# Copyright (C) 2015 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import re
from swh.core import hashutil
# Regexp to filter and check inputs
-sha256_regexp='[0-9a-f]{64}'
-sha1_regexp='[0-9a-f]{40}'
+sha256_regexp = '[0-9a-f]{64}'
+sha1_regexp = '[0-9a-f]{40}'
def categorize_hash(hash):
"""Categorize the hash string according to what it is.
Args:
hash: hash string representation (sha1 or sha256)
Returns:
A dictionary of hash indexed by their nature (sha1, sha256)
The dictionary will be empty if nothing matches
Raises:
None
"""
try:
h = hashutil.hex_to_hash(hash)
except ValueError: # ignore silently to check the other inputs
return {}
if re.search(sha256_regexp, hash):
return {'sha256': h}
if re.search(sha1_regexp, hash):
return {'sha1': h}
return {}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Aug 18, 11:45 PM (2 w, 21 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3326524

Event Timeline