From 4ff91344797718246c9ee62ef53883eb25cabd49 Mon Sep 17 00:00:00 2001 From: Dan MacKinlay Date: Fri, 22 Feb 2019 20:37:30 +1100 Subject: [PATCH] working pandoc URL unquoter --- pandoc_reader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandoc_reader.py b/pandoc_reader.py index bde84fe..bf8704c 100644 --- a/pandoc_reader.py +++ b/pandoc_reader.py @@ -78,8 +78,12 @@ class PandocReader(BaseReader): status = proc.wait() if status: raise subprocess.CalledProcessError(status, pandoc_cmd) - - return urllib.parse.unquote(output), metadata + # pandoc will aggressively percent-encode URLs, breaking things. + # This nasty hack will undo such quoting (in fact too aggressively, if + # I have percent signs in my content, but I don't + # so I don't care for now) str.replace might be saner. + output = urllib.parse.unquote(output) + return output, metadata def add_reader(readers):