Skip to content

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

fix: remove integrity check

thecodrr179fcb1b29e3
diff --git a/apps/web/src/interfaces/fs.js b/apps/web/src/interfaces/fs.js
index f0cc8b793..f3c5c7508 100644
--- a/apps/web/src/interfaces/fs.js
+++ b/apps/web/src/interfaces/fs.js
@@ -9,9 +9,7 @@ import hosts from "notes-core/utils/constants";
import { sendAttachmentsProgressEvent } from "notes-core/common";
import { saveAs } from "file-saver";
import { showToast } from "../utils/toast";
-import SparkMD5 from "spark-md5";
-const sparkMD5 = new SparkMD5.ArrayBuffer();
const ABYTES = 17;
const CHUNK_SIZE = 512 * 1024;
const ENCRYPTED_CHUNK_SIZE = CHUNK_SIZE + ABYTES;
@@ -295,14 +293,6 @@ async function downloadFile(filename, requestOptions) {
return false;
}
- let etag = response.headers["etag"] || response.headers["ETag"];
- if (etag) {
- etag = JSON.parse(etag);
- if (!verify(response.data, etag, "md5")) {
- throw new Error("File verification failed.");
- }
- }
-
const distributor = new ChunkDistributor(chunkSize + ABYTES);
distributor.fill(new Uint8Array(response.data));
distributor.close();
@@ -326,21 +316,6 @@ async function downloadFile(filename, requestOptions) {
}
}
-/**
- *
- * @param {ArrayBuffer} data
- * @param {string} hash
- * @param {"md5"} hashType
- */
-function verify(data, hash, hashType = "md5") {
- switch (hashType) {
- case "md5":
- return sparkMD5.append(data).end() === hash;
- default:
- return false;
- }
-}
-
function exists(filename) {
return streamablefs.exists(filename);
}