From 94fda96280ae44bf2089701df6c2240875b18d25 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sun, 21 Oct 2018 07:36:53 +0100 Subject: [PATCH] Support local anchors with a URL #428 (#429) Fixes #428 --- www/js/app.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/www/js/app.js b/www/js/app.js index 13e7f293..072a4f5b 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -741,7 +741,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles iframeArticleContent.onload = function () {}; $("#searchingArticles").hide(); }; - iframeArticleContent.src = dirEntry.namespace + "/" + dirEntry.url; + iframeArticleContent.src = dirEntry.namespace + "/" + encodeURIComponent(dirEntry.url); // Display the iframe content $("#articleContent").show(); }; @@ -814,8 +814,6 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles var regexpPath = /^(.*\/)[^\/]+$/; // Pattern to find a ZIM URL (with its namespace) - see http://www.openzim.org/wiki/ZIM_file_format#Namespaces var regexpZIMUrlWithNamespace = /(?:^|\/)([-ABIJMUVWX]\/.+)/; - // Pattern to match a local anchor in a href - var regexpLocalAnchorHref = /^#/; // Regex below finds images, scripts and stylesheets with ZIM-type metadata and image namespaces [kiwix-js #378] // It first searches for