summaryrefslogtreecommitdiff
path: root/poezio/xhtml.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-05-15 22:47:19 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-05-15 22:47:19 +0100
commitc66c5a6e27782023dac7ccff71038e880be0ad1c (patch)
treea2ea09c1a6c066a74b0e28a74dc0372e9fcee59b /poezio/xhtml.py
parent2419e821438e65b27c47761c581f93a6ddb03a5c (diff)
downloadpoezio-c66c5a6e27782023dac7ccff71038e880be0ad1c.tar.gz
poezio-c66c5a6e27782023dac7ccff71038e880be0ad1c.tar.bz2
poezio-c66c5a6e27782023dac7ccff71038e880be0ad1c.tar.xz
poezio-c66c5a6e27782023dac7ccff71038e880be0ad1c.zip
Replace '/' with '-' in base64 hashes before saving an image.
Fixes #3312.
Diffstat (limited to 'poezio/xhtml.py')
-rw-r--r--poezio/xhtml.py2
1 files changed, 1 insertions, 1 deletions
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):