From e0975130b6152fa9b4035a980aa6084442fd395f Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 24 Apr 2024 15:10:15 +0530 Subject: [PATCH] More context from Discord --- web/apps/photos/src/services/upload/uploadService.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.ts index e208fd4447..7ead795b76 100644 --- a/web/apps/photos/src/services/upload/uploadService.ts +++ b/web/apps/photos/src/services/upload/uploadService.ts @@ -760,6 +760,12 @@ const areFilesSameHash = (f: Metadata, g: Metadata) => { /** * Older files that were uploaded before we introduced hashing will not have * hashes, so retain and use the logic we used back then for such files. + * + * Deprecation notice April 2024: Note that hashing was introduced very early + * (years ago), so the chance of us finding files without hashes is rare. And + * even in these cases, the worst that'll happen is that a duplicate file would + * get uploaded which can later be deduped. So we can get rid of this case at + * some point (e.g. the mobile app doesn't do this extra check, just uploads). */ const areFilesSameNoHash = (f: Metadata, g: Metadata) => { /* @@ -773,10 +779,10 @@ const areFilesSameNoHash = (f: Metadata, g: Metadata) => { */ const oneSecond = 1e6; return ( - f.fileType === g.fileType && + f.fileType == g.fileType && + f.title == g.title && Math.abs(f.creationTime - g.creationTime) < oneSecond && - Math.abs(f.modificationTime - g.modificationTime) < oneSecond && - f.title === g.title + Math.abs(f.modificationTime - g.modificationTime) < oneSecond ); };