From 77171a0d1844cd753800c94279efa6de2a779c5c Mon Sep 17 00:00:00 2001 From: Taka Date: Tue, 15 Dec 2020 10:12:37 +1100 Subject: [PATCH] Only translate relative image URL's in Chapter H notes. --- vasl_templates/webapp/vo_notes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vasl_templates/webapp/vo_notes.py b/vasl_templates/webapp/vo_notes.py index fd23a96..f0a7b61 100644 --- a/vasl_templates/webapp/vo_notes.py +++ b/vasl_templates/webapp/vo_notes.py @@ -259,7 +259,10 @@ def _fixup_urls( html, url_stem ): """Fixup URL's to Chapter H files.""" matches = list( re.finditer( r"]*src=(['\"])(.*?)\1", html ) ) for mo in reversed(matches): - html = html[:mo.start(2)] + url_stem+ html[mo.start(2):] + before, after = html[:mo.start(2)], html[mo.start(2):] + if after.startswith( ( "http://", "https://", "file://" ) ): + continue + html = before + url_stem + after return html # ---------------------------------------------------------------------