mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
web: fix attachment not getting marked as failed on error
This commit is contained in:
committed by
Abdullah Atta
parent
b22770f1ae
commit
00754593ac
@@ -497,13 +497,13 @@ async function downloadFile(
|
|||||||
);
|
);
|
||||||
if (contentLength === 0 || isNaN(contentLength)) {
|
if (contentLength === 0 || isNaN(contentLength)) {
|
||||||
const error = `File length is 0. Please upload this file again from the attachment manager. (File hash: ${filename})`;
|
const error = `File length is 0. Please upload this file again from the attachment manager. (File hash: ${filename})`;
|
||||||
await db.attachments.markAsFailed(filename, error);
|
await db.attachments.markAsFailed(attachment.id, error);
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response.body) {
|
if (!response.body) {
|
||||||
const error = `The download response does not contain a body. Please upload this file again from the attachment manager. (File hash: ${filename})`;
|
const error = `The download response does not contain a body. Please upload this file again from the attachment manager. (File hash: ${filename})`;
|
||||||
await db.attachments.markAsFailed(filename, error);
|
await db.attachments.markAsFailed(attachment.id, error);
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ async function downloadFile(
|
|||||||
const decryptedLength = contentLength - totalChunks * ABYTES;
|
const decryptedLength = contentLength - totalChunks * ABYTES;
|
||||||
if (attachment && attachment.size !== decryptedLength) {
|
if (attachment && attachment.size !== decryptedLength) {
|
||||||
const error = `File length mismatch. Please upload this file again from the attachment manager. (File hash: ${filename})`;
|
const error = `File length mismatch. Please upload this file again from the attachment manager. (File hash: ${filename})`;
|
||||||
await db.attachments.markAsFailed(filename, error);
|
await db.attachments.markAsFailed(attachment.id, error);
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user