fix(core): cannot download comment files (#13136)
#### PR Dependency Tree * **PR #13136** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -337,6 +337,7 @@ export class DocCommentStore extends Entity<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
const res = await graphql.gql({
|
const res = await graphql.gql({
|
||||||
|
timeout: 180_000,
|
||||||
query: uploadCommentAttachmentMutation,
|
query: uploadCommentAttachmentMutation,
|
||||||
variables: {
|
variables: {
|
||||||
workspaceId: this.currentWorkspaceId,
|
workspaceId: this.currentWorkspaceId,
|
||||||
|
|||||||
@@ -42,13 +42,6 @@ export function downloadFile(url: string, filename: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadResourceWithUrl(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
|
// given input url may not have correct mime type
|
||||||
const blob = await resourceUrlToBlob(url);
|
const blob = await resourceUrlToBlob(url);
|
||||||
if (!blob) return;
|
if (!blob) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user