Fix getRevisionPageByPath in v2 not encoding the path correctly (#3121)

This commit is contained in:
Samy Pessé
2025-04-08 18:29:08 +02:00
committed by GitHub
parent c765463e38
commit 3b0eff7f71
2 changed files with 17 additions and 2 deletions
+3 -2
View File
@@ -531,7 +531,7 @@ const getRevisionPageByPath = withCacheKey(
) => {
const uncached = unstable_cache(
async () => getRevisionPageByPathUncached(cacheKey, input, params),
[cacheKey],
[cacheKey, 'v2'],
{
revalidate: RevalidationProfile.max,
tags: [],
@@ -551,12 +551,13 @@ const getRevisionPageByPathUncached = withoutConcurrentExecution(
return trace(
`getRevisionPageByPath.uncached(${params.spaceId}, ${params.revisionId}, ${params.path})`,
async () => {
const encodedPath = encodeURIComponent(params.path);
return wrapDataFetcherError(async () => {
const api = apiClient(input);
const res = await api.spaces.getPageInRevisionByPath(
params.spaceId,
params.revisionId,
params.path,
encodedPath,
{}
);
return res.data;
+14
View File
@@ -837,6 +837,20 @@ const testCases: TestsCase[] = [
},
],
},
{
name: 'Content Redirects',
contentBaseURL: 'https://gitbook-open-e2e-sites.gitbook.io/gitbook-doc/',
tests: [
{
name: 'Redirect to new location',
url: '/content-editor/editing-content/inline/redirect-test',
run: async (page) => {
await expect(page.locator('h1')).toHaveText('Redirect test');
},
screenshot: false,
},
],
},
{
name: 'Site Redirects with sections',
contentBaseURL: 'https://gitbook-open-e2e-sites.gitbook.io/sections/',