From 7d527c7f3aed9550b9c45ebeaa5c64c9c7c42631 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 10 Jul 2025 15:48:17 +0800 Subject: [PATCH] fix(core): cannot download comment files (#13136) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### PR Dependency Tree * **PR #13136** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) ## Summary by CodeRabbit * **New Features** * Added a timeout of 3 minutes to comment attachment uploads, improving reliability for long uploads. * **Refactor** * Unified the file download process to always use blob conversion, ensuring consistent behavior for all URLs. --- .../core/src/modules/comment/entities/doc-comment-store.ts | 1 + packages/frontend/core/src/utils/resource.ts | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/frontend/core/src/modules/comment/entities/doc-comment-store.ts b/packages/frontend/core/src/modules/comment/entities/doc-comment-store.ts index 54972d1c58..da1a3dc36d 100644 --- a/packages/frontend/core/src/modules/comment/entities/doc-comment-store.ts +++ b/packages/frontend/core/src/modules/comment/entities/doc-comment-store.ts @@ -337,6 +337,7 @@ export class DocCommentStore extends Entity<{ } const res = await graphql.gql({ + timeout: 180_000, query: uploadCommentAttachmentMutation, variables: { workspaceId: this.currentWorkspaceId, diff --git a/packages/frontend/core/src/utils/resource.ts b/packages/frontend/core/src/utils/resource.ts index 06ac38b279..cb002c9abd 100644 --- a/packages/frontend/core/src/utils/resource.ts +++ b/packages/frontend/core/src/utils/resource.ts @@ -42,13 +42,6 @@ export function downloadFile(url: string, filename: string) { } export async function downloadResourceWithUrl(url: string, filename: string) { - // 1. if url is not same origin, fetch it to blob and download it - // 2. otherwise, download it directly - const sameOrigin = new URL(url).origin === window.location.origin; - if (sameOrigin) { - downloadFile(url, filename); - return; - } // given input url may not have correct mime type const blob = await resourceUrlToBlob(url); if (!blob) return;