From d9342acf5b830a9ab59740578622c45f47cfcc76 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 26 Dec 2022 17:17:47 +0400 Subject: [PATCH] Suggestion link points to /content endpoint Directly pointing the suggestion link to a /content/... URL avoids an unnecessary redirection by the server (and an associated bug related to redirection of URLs with URI-encoded special symbols in them that - in the current implementation - go into the target URL in decoded form). --- static/skin/viewer.js | 2 +- test/server.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/static/skin/viewer.js b/static/skin/viewer.js index 24050a3b7..f9d9f3bbc 100644 --- a/static/skin/viewer.js +++ b/static/skin/viewer.js @@ -350,7 +350,7 @@ function setupSuggestions() { let url; if (data.value.kind == "path") { const path = encodeURIComponent(htmlDecode(data.value.path)); - url = `/${uriEncodedBookName}/${path}`; + url = `/content/${uriEncodedBookName}/${path}`; } else { const pattern = encodeURIComponent(htmlDecode(data.value.value)); url = `/search?content=${uriEncodedBookName}&pattern=${pattern}`; diff --git a/test/server.cpp b/test/server.cpp index 9b2da29a8..0780a3949 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -69,7 +69,7 @@ const ResourceCollection resources200Compressible{ { DYNAMIC_CONTENT, "/ROOT/skin/taskbar.css" }, { STATIC_CONTENT, "/ROOT/skin/taskbar.css?cacheid=216d6b5d" }, { DYNAMIC_CONTENT, "/ROOT/skin/viewer.js" }, - { STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=23966598" }, + { STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=ab5374c5" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf" }, { STATIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf?cacheid=af705837" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Roboto.ttf" }, @@ -291,7 +291,7 @@ R"EXPECTEDRESULT( - + const blankPageUrl = root + "/skin/blank.html?cacheid=6b1fa032";