From 6665995e35afe25e59786c8a48aa0073c670d8fd Mon Sep 17 00:00:00 2001 From: hntk03 Date: Fri, 14 Nov 2025 20:25:34 +0900 Subject: [PATCH 1/2] fix encoding of URLs in search results --- CHANGES.rst | 2 ++ sphinx/themes/basic/static/searchtools.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index f0f94fda396..fec973c7286 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -137,6 +137,8 @@ Bugs fixed * #14004: Fix :confval:`autodoc_type_aliases` when they appear in PEP 604 union syntax (``Alias | Type``). Patch by Tamika Nomara. +* #14028: Fix the encoding of URLs in search results. + Patch by Taiki Ohno. Testing diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js index 5a7628a18a2..83c5fcd96b1 100644 --- a/sphinx/themes/basic/static/searchtools.js +++ b/sphinx/themes/basic/static/searchtools.js @@ -89,7 +89,8 @@ const _displayItem = (item, searchTerms, highlightTerms) => { linkUrl = docName + docLinkSuffix; } let linkEl = listItem.appendChild(document.createElement("a")); - linkEl.href = linkUrl + anchor; + const encodedLinkUrl = linkUrl.split("/").map(encodeURIComponent).join("/"); + linkEl.href = encodedLinkUrl + anchor; linkEl.dataset.score = score; linkEl.innerHTML = title; if (descr) { From 1acd345774e7e1bc8b8d63df5c668e4ff0413c27 Mon Sep 17 00:00:00 2001 From: hntk03 Date: Fri, 14 Nov 2025 21:06:57 +0900 Subject: [PATCH 2/2] add name to AUTHORS.rst --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 707c77aec04..6b244a04b92 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -108,6 +108,7 @@ Contributors * Steve Piercy -- documentation improvements * Szymon Karpinski -- intersphinx improvements * \T. Powers -- HTML output improvements +* Taiki Ohno -- bug fixes in search results * Taku Shimizu -- epub3 builder * Tamika Nomara -- bug fixes * Thomas Lamb -- linkcheck builder