mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 08:09:52 +08:00
fix(core): share page show 404 (#9083)
This commit is contained in:
@@ -18,6 +18,9 @@ export class ShareReaderStore extends Store {
|
|||||||
const docResponse = await this.rawFetch.fetch(
|
const docResponse = await this.rawFetch.fetch(
|
||||||
`/api/workspaces/${workspaceId}/docs/${docId}`
|
`/api/workspaces/${workspaceId}/docs/${docId}`
|
||||||
);
|
);
|
||||||
|
if (docResponse.status !== 200) {
|
||||||
|
throw new Error('Failed to fetch workspace');
|
||||||
|
}
|
||||||
const publishMode = docResponse.headers.get(
|
const publishMode = docResponse.headers.get(
|
||||||
'publish-mode'
|
'publish-mode'
|
||||||
) as DocMode | null;
|
) as DocMode | null;
|
||||||
@@ -26,6 +29,9 @@ export class ShareReaderStore extends Store {
|
|||||||
const workspaceResponse = await this.rawFetch.fetch(
|
const workspaceResponse = await this.rawFetch.fetch(
|
||||||
`/api/workspaces/${workspaceId}/docs/${workspaceId}`
|
`/api/workspaces/${workspaceId}/docs/${workspaceId}`
|
||||||
);
|
);
|
||||||
|
if (workspaceResponse.status !== 200) {
|
||||||
|
throw new Error('Failed to fetch workspace');
|
||||||
|
}
|
||||||
const workspaceBinary = await workspaceResponse.arrayBuffer();
|
const workspaceBinary = await workspaceResponse.arrayBuffer();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -340,3 +340,13 @@ test('The reference links in the shared page should be accessible normally and c
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Should show no permission page when the share page is not found', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await page.goto('http://localhost:8080/workspace/abc/123');
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByText('You do not have access or this content does not exist.')
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user