Merge pull request #893 from brian-spackman/fix-fractional-mtime-on-linux

fix: truncate sub-millisecond CLI mtimes to prevent mobile crash
This commit is contained in:
vorotamoroz
2026-05-13 19:12:56 +09:00
committed by GitHub
4 changed files with 12 additions and 12 deletions
@@ -98,8 +98,8 @@ export class NodeFileSystemAdapter implements IFileSystemAdapter<NodeFile, NodeF
path: pathStr as FilePath, path: pathStr as FilePath,
stat: { stat: {
size: stat.size, size: stat.size,
mtime: stat.mtimeMs, mtime: Math.floor(stat.mtimeMs),
ctime: stat.ctimeMs, ctime: Math.floor(stat.ctimeMs),
type: "file", type: "file",
}, },
}; };
@@ -132,8 +132,8 @@ export class NodeFileSystemAdapter implements IFileSystemAdapter<NodeFile, NodeF
path: entryRelativePath as FilePath, path: entryRelativePath as FilePath,
stat: { stat: {
size: stat.size, size: stat.size,
mtime: stat.mtimeMs, mtime: Math.floor(stat.mtimeMs),
ctime: stat.ctimeMs, ctime: Math.floor(stat.ctimeMs),
type: "file", type: "file",
}, },
}; };
+2 -2
View File
@@ -28,8 +28,8 @@ export class NodeStorageAdapter implements IStorageAdapter<NodeStat> {
const stat = await fs.stat(this.resolvePath(p)); const stat = await fs.stat(this.resolvePath(p));
return { return {
size: stat.size, size: stat.size,
mtime: stat.mtimeMs, mtime: Math.floor(stat.mtimeMs),
ctime: stat.ctimeMs, ctime: Math.floor(stat.ctimeMs),
type: stat.isDirectory() ? "folder" : "file", type: stat.isDirectory() ? "folder" : "file",
}; };
} catch { } catch {
+4 -4
View File
@@ -73,8 +73,8 @@ export class NodeVaultAdapter implements IVaultAdapter<NodeFile> {
path: p as any, path: p as any,
stat: { stat: {
size: stat.size, size: stat.size,
mtime: stat.mtimeMs, mtime: Math.floor(stat.mtimeMs),
ctime: stat.ctimeMs, ctime: Math.floor(stat.ctimeMs),
type: "file", type: "file",
}, },
}; };
@@ -96,8 +96,8 @@ export class NodeVaultAdapter implements IVaultAdapter<NodeFile> {
path: p as any, path: p as any,
stat: { stat: {
size: stat.size, size: stat.size,
mtime: stat.mtimeMs, mtime: Math.floor(stat.mtimeMs),
ctime: stat.ctimeMs, ctime: Math.floor(stat.ctimeMs),
type: "file", type: "file",
}, },
}; };
+2 -2
View File
@@ -173,8 +173,8 @@ export async function runCommand(options: CLIOptions, context: CLICommandContext
console.log(`[Command] push ${sourcePath} -> ${destinationDatabasePath}`); console.log(`[Command] push ${sourcePath} -> ${destinationDatabasePath}`);
await core.serviceModules.storageAccess.writeFileAuto(destinationDatabasePath, toArrayBuffer(sourceData), { await core.serviceModules.storageAccess.writeFileAuto(destinationDatabasePath, toArrayBuffer(sourceData), {
mtime: sourceStat.mtimeMs, mtime: Math.floor(sourceStat.mtimeMs),
ctime: sourceStat.ctimeMs, ctime: Math.floor(sourceStat.ctimeMs),
}); });
const destinationPathWithPrefix = destinationDatabasePath as FilePathWithPrefix; const destinationPathWithPrefix = destinationDatabasePath as FilePathWithPrefix;
const stored = await core.serviceModules.fileHandler.storeFileToDB(destinationPathWithPrefix, true); const stored = await core.serviceModules.fileHandler.storeFileToDB(destinationPathWithPrefix, true);