Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix file size is 0 error on attachment upload (#9951)

Abdullah Atta86512b5ce738
diff --git a/apps/web/src/interfaces/fs.ts b/apps/web/src/interfaces/fs.ts
index fda669c2e..7049b0a1f 100644
--- a/apps/web/src/interfaces/fs.ts
+++ b/apps/web/src/interfaces/fs.ts
@@ -714,7 +714,10 @@ export async function getUploadedFileSize(filename: string) {
headers: { Authorization: `Bearer ${token}` }
});
- const contentLength = parseInt(attachmentInfo.headers["content-length"]);
+ const contentLength = parseInt(
+ attachmentInfo.headers["x-object-size"] ??
+ attachmentInfo.headers["content-length"]
+ );
return isNaN(contentLength) ? 0 : contentLength;
} catch (e) {
logger.error(e, "Failed to get uploaded file size.", { filename });