mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 01:25:16 +00:00
Fix getRevisionPageByPath in v2 not encoding the path correctly (#3121)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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/',
|
||||
|
||||
Reference in New Issue
Block a user