diff --git a/packages/gitbook-v2/src/lib/data/api.ts b/packages/gitbook-v2/src/lib/data/api.ts index e308c39bb..9fe5eefab 100644 --- a/packages/gitbook-v2/src/lib/data/api.ts +++ b/packages/gitbook-v2/src/lib/data/api.ts @@ -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; diff --git a/packages/gitbook/e2e/internal.spec.ts b/packages/gitbook/e2e/internal.spec.ts index 4b244a0c4..05bddb28c 100644 --- a/packages/gitbook/e2e/internal.spec.ts +++ b/packages/gitbook/e2e/internal.spec.ts @@ -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/',