From ea2a355bcc34a852bae261b6c4e16b16b0bd9a04 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 23 May 2024 14:34:24 +0530 Subject: [PATCH] Revert to the behaviour of the existing 1.6.63 client --- desktop/src/main/stream.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.ts index 262e4dc05..c11fb1121 100644 --- a/desktop/src/main/stream.ts +++ b/desktop/src/main/stream.ts @@ -106,12 +106,7 @@ const handleRead = async (path: string) => { res.headers.set("Content-Length", `${fileSize}`); // Add the file's last modified time (as epoch milliseconds). - // - // [Note: Use integral epoch milliseconds] - // - // The `mtimeMs` returned by Node.js is a double, with sub-millisecond - // precision. Ente clients expect integral milliseconds, so truncate. - const mtimeMs = Math.trunc(stat.mtimeMs); + const mtimeMs = stat.mtime.getTime(); res.headers.set("X-Last-Modified-Ms", `${mtimeMs}`); } return res; @@ -142,11 +137,7 @@ const handleReadZip = async (zipPath: string, entryName: string) => { // verify that it is indeed epoch milliseconds. See `parseZipTime` // in the node-stream-zip source, // https://github.com/antelle/node-stream-zip/blob/master/node_stream_zip.js - // - // See also: [Note: Use integral epoch milliseconds]. In this case I didn't - // actually find an example of submillisecond precision, just being - // preemptively careful and this Math.trunc might not necessarily be needed. - const modifiedMs = Math.trunc(entry.time); + const modifiedMs = entry.time; return new Response(webReadableStream, { headers: {