More context from Discord

This commit is contained in:
Manav Rathi 2024-04-24 15:10:15 +05:30
parent 80802d44e3
commit e0975130b6
No known key found for this signature in database

View file

@ -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
);
};