There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(core): share page show 404 (#9083)
EYHN18d65dff0e50
diff --git a/packages/frontend/core/src/modules/share-doc/stores/share-reader.ts b/packages/frontend/core/src/modules/share-doc/stores/share-reader.tsindex bf41d02ffd..ca8b6a3147 100644--- a/packages/frontend/core/src/modules/share-doc/stores/share-reader.ts+++ b/packages/frontend/core/src/modules/share-doc/stores/share-reader.ts@@ -18,6 +18,9 @@ export class ShareReaderStore extends Store {const docResponse = await this.rawFetch.fetch(`/api/workspaces/${workspaceId}/docs/${docId}`);+ if (docResponse.status !== 200) {+ throw new Error('Failed to fetch workspace');+ }const publishMode = docResponse.headers.get('publish-mode') as DocMode | null;@@ -26,6 +29,9 @@ export class ShareReaderStore extends Store {const workspaceResponse = await this.rawFetch.fetch(`/api/workspaces/${workspaceId}/docs/${workspaceId}`);+ if (workspaceResponse.status !== 200) {+ throw new Error('Failed to fetch workspace');+ }const workspaceBinary = await workspaceResponse.arrayBuffer();return {diff --git a/tests/affine-cloud/e2e/share-page.spec.ts b/tests/affine-cloud/e2e/share-page.spec.tsindex a58b6ddd7e..4d5c0a6c54 100644--- a/tests/affine-cloud/e2e/share-page.spec.ts+++ b/tests/affine-cloud/e2e/share-page.spec.ts@@ -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();+});