Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
test(search): verify slash text over HTTP
Ampdf03c4267575
diff --git a/apps/server/e2e/exact_search.spec.ts b/apps/server/e2e/exact_search.spec.tsindex 82394315c5..0e88f46e65 100644--- a/apps/server/e2e/exact_search.spec.ts+++ b/apps/server/e2e/exact_search.spec.ts@@ -156,12 +156,28 @@ test.describe("Exact Search with Leading = Operator", () => {});test("Search APIs accept slash-bearing query text", async ({ page }) => {+ const noteResponse = await page.request.post(`${BASE_URL}/api/notes/root/children?target=into&targetBranchId=`, {+ headers: { "x-csrf-token": csrfToken },+ data: {+ title: "中/英",+ content: "Slash-bearing search transport test.",+ type: "text"+ }+ });+ expect(noteResponse.ok()).toBeTruthy();+ const noteId = (await noteResponse.json()).note.noteId;+ createdNoteIds.push(noteId);+ await page.waitForTimeout(500);+for (const path of [ "quick-search", "search" ] as const) {const response = await page.request.get(getSearchUrl(path, "中/英"), {headers: { "x-csrf-token": csrfToken }});expect(response.ok()).toBeTruthy();+ const data = await response.json();+ const noteIds = path === "quick-search" ? data.searchResultNoteIds : data;+ expect(noteIds).toContain(noteId);}});diff --git a/apps/server/internal.openapi.yaml b/apps/server/internal.openapi.yamlindex 3b6d1bff71..92f83e1419 100644--- a/apps/server/internal.openapi.yaml+++ b/apps/server/internal.openapi.yaml@@ -1951,12 +1951,6 @@ paths:responses:'200':description: Search results- content:- application/json:- schema:- type: array- items:- $ref: '#/components/schemas/SearchResult'/api/quick-search:get:@@ -1998,12 +1992,6 @@ paths:responses:'200':description: Quick search results- content:- application/json:- schema:- type: array- items:- $ref: '#/components/schemas/SearchResult'/api/search-note/{noteId}:get:diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.htmlindex 35b49e10c2..3acdfc72af 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.html@@ -3,9 +3,11 @@reference.</p><h2>Breaking change in Traefik 3.6.4</h2><p>Traefik 3.6.4 introduced a <a href="https://doc.traefik.io/traefik/migrate/v3/#encoded-characters-in-request-path">breaking change</a> regarding- how percent-encoded characters are handled in URLs. More specifically some- URLs used by Trilium (such as <code spellcheck="false">search/%23workspace%20%23!template</code>)- are automatically rejected by Traefik, resulting in HTTP 400 errors.</p>+ how percent-encoded characters are handled in URLs. Earlier Trilium clients+ sent search text in paths such as <code spellcheck="false">/api/search/%23workspace%20%23!template</code>.+ Traefik automatically rejects these paths and returns HTTP 400. Updated clients+ send search text in a query parameter, but a cached older client can still use+ the old path.</p><p>The easiest solution is to update to Traefik 3.6.7 or later which revertsthis configuration change. Alternatively, the configuration can be changedaccording to the section below.</p>@@ -19,8 +21,8 @@allowEncodedSlash: trueallowEncodedHash: true</code></pre><aside class="admonition tip">- <p>If you still have issues, depending on how Trilium is used (especially- regarding search), you might need to enable more encoded character groups.+ <p>If issues continue with an older client, you might need to enable more+ encoded character groups.For more information, see <a href="https://github.com/TriliumNext/Trilium/issues/7968">the relevant GitHub issue</a>;feel free to report your findings.</p></aside>@@ -70,4 +72,4 @@networks:traefik-proxy:- external: true</code></pre>\ No newline at end of file+ external: true</code></pre>diff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.mdindex a869934f68..f49f8b4cb5 100644--- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.md+++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.md@@ -3,7 +3,7 @@ The goal of this article is to configure Traefik proxy and HTTPS. See [#7768](ht## Breaking change in Traefik 3.6.4-Traefik 3.6.4 introduced a [breaking change](https://doc.traefik.io/traefik/migrate/v3/#encoded-characters-in-request-path) regarding how percent-encoded characters are handled in URLs. Some paths used by older Trilium clients, such as `/api/search/%23workspace%20%23!template`, are automatically rejected by Traefik and result in HTTP 400 errors. Current clients send search text in a query parameter, but older clients and other routes can still need this configuration.+Traefik 3.6.4 introduced a [breaking change](https://doc.traefik.io/traefik/migrate/v3/#encoded-characters-in-request-path) regarding how percent-encoded characters are handled in URLs. Earlier Trilium clients sent search text in paths such as `/api/search/%23workspace%20%23!template`. Traefik automatically rejects these paths and returns HTTP 400. Updated clients send search text in a query parameter, but a cached older client can still use the old path.The easiest solution is to update to Traefik 3.6.7 or later which reverts this configuration change. Alternatively, the configuration can be changed according to the section below.@@ -16,7 +16,7 @@ The easiest solution is to update to Traefik 3.6.7 or later which reverts this cencodedCharacters:allowEncodedSlash: trueallowEncodedHash: true</code></pre>- <aside class="admonition tip"><p>If you still have issues, older clients or other routes might need more encoded character groups. For more information, see <a href="https://github.com/TriliumNext/Trilium/issues/7968">the relevant GitHub issue</a>; feel free to report your findings.</p></aside>+ <aside class="admonition tip"><p>If issues continue with an older client, you might need to enable more encoded character groups. For more information, see <a href="https://github.com/TriliumNext/Trilium/issues/7968">the relevant GitHub issue</a>; feel free to report your findings.</p></aside></details>### Build the docker-compose file