Recognize replaced automation files and update secure watcher for 2.1.53
CI / verify (push) Canceled after 0s
CI / verify (push) Canceled after 0s
This commit is contained in:
1 parent
f2e400c89e
commit
d19d7faa19
9 files changed
+89
-178
No files matched your search
@@ -64,7 +64,10 @@
|
||||
fileHandle = await openPath(filePath, 'r');
|
||||
const fileStat = await fileHandle.stat();
|
||||
if (!fileStat.isFile()) return { exists: true, readable: false, size: fileStat.size, mtimeMs: fileStat.mtimeMs };
|
||||
return { exists: true, readable: true, size: fileStat.size, mtimeMs: fileStat.mtimeMs };
|
||||
const identityParts = [fileStat.dev, fileStat.ino, fileStat.birthtimeMs, fileStat.ctimeMs];
|
||||
const fileIdentity = identityParts.every(value => typeof value === 'number' && Number.isFinite(value))
|
||||
? `v1:${identityParts.join(':')}` : '';
|
||||
return { exists: true, readable: true, size: fileStat.size, mtimeMs: fileStat.mtimeMs, ...(fileIdentity ? { fileIdentity } : {}) };
|
||||
} catch (error) {
|
||||
if (error && (error.code === 'ENOENT' || error.code === 'ENOTDIR')) return { exists: false };
|
||||
return { exists: true, readable: false };
|
||||
@@ -112,7 +115,7 @@
|
||||
const reason = unavailableReason(result);
|
||||
const mtimeMs = Number.isFinite(Number(result?.mtimeMs)) ? Number(result.mtimeMs) : entry.mtimeMs;
|
||||
if (reason) return { entry: { ...entry, size: Number(result?.size) || 0, mtimeMs }, reason };
|
||||
return { entry: { ...entry, size: Number(result.size), mtimeMs }, reason: '' };
|
||||
return { entry: { ...entry, size: Number(result.size), mtimeMs, ...(result.fileIdentity ? { fileIdentity: result.fileIdentity } : {}) }, reason: '' };
|
||||
} catch (error) {
|
||||
return { entry, reason: error && error.code === 'ENOENT' ? 'missing' : 'unreadable' };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user