mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-03 06:48:18 +00:00
fix(customisation-sync): stop truncating entry mtimes to 32 bits
PluginDataExDisplayV2.mtime applied `~~` to the sum of millisecond timestamps before dividing, which keeps only the low 32 bits. The freshness chip and "Select All Shiny" then compared wrapped values and could offer an older copy as newer. Fixes #1194
This commit is contained in:
1 parent
ba297d1233
commit
b7f38abae9
2 files changed
+25
-2
No files matched your search
@@ -368,7 +368,8 @@ export class PluginDataExDisplayV2 {
|
||||
return this._version;
|
||||
}
|
||||
get mtime(): number {
|
||||
return ~~this.files.reduce((a, b) => a + b.mtime, 0) / this.files.length;
|
||||
// Millisecond timestamps exceed 32 bits, so `~~` would wrap them.
|
||||
return Math.floor(this.files.reduce((a, b) => a + b.mtime, 0) / this.files.length);
|
||||
}
|
||||
}
|
||||
export type PluginDataEx = {
|
||||
|
||||
Reference in new issue
Block a user