From c66c5a6e27782023dac7ccff71038e880be0ad1c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 15 May 2017 22:47:19 +0100 Subject: Replace '/' with '-' in base64 hashes before saving an image. Fixes #3312. --- poezio/xhtml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'poezio/xhtml.py') diff --git a/poezio/xhtml.py b/poezio/xhtml.py index 9ddbb939..6da6e0da 100644 --- a/poezio/xhtml.py +++ b/poezio/xhtml.py @@ -295,7 +295,7 @@ def trim(string): def get_hash(data: bytes) -> str: # Currently using SHA-256, this might change in the future. # base64 gives shorter hashes than hex, so use that. - return b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode() + return b64encode(hashlib.sha256(data).digest()).rstrip(b'=').replace(b'/', b'-').decode() class XHTMLHandler(sax.ContentHandler): def __init__(self, force_ns=False, tmp_dir=None, extract_images=False): -- cgit v1.2.3