mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-14 20:20:12 +00:00
fix: inspect and repair incorrect recorded file sizes
This commit is contained in:
1 parent
fc5f02ca3b
commit
4a245debe7
11 files changed
+488
-57
No files matched your search
@@ -32,12 +32,14 @@ import {
|
||||
chooseAndCopyFileDatabaseInfo,
|
||||
collectFileDatabaseInfoPaths,
|
||||
copyFileDatabaseInfo,
|
||||
inspectFileDatabaseInfo,
|
||||
retryReadFileDatabaseRevision,
|
||||
} from "@/serviceFeatures/fileDatabaseInfo.ts";
|
||||
import {
|
||||
discardLiveBranch,
|
||||
discardUnreadableLiveRevision,
|
||||
inspectFileRepair,
|
||||
repairRevisionSize,
|
||||
type FileRepairInspection,
|
||||
type FileRepairRevision,
|
||||
} from "@/serviceFeatures/fileRepair.ts";
|
||||
@@ -786,6 +788,31 @@ export function paneHatch(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (metadata.revision && policy.repairSize) {
|
||||
revisionActions.push({
|
||||
title: $msg("Correct recorded file size"),
|
||||
run: async () => {
|
||||
await runMutation(
|
||||
`Correct the recorded size on database revision ${metadata.revision}`,
|
||||
async () => {
|
||||
const result = await repairRevisionSize(
|
||||
this.core,
|
||||
path,
|
||||
metadata.revision!
|
||||
);
|
||||
if (result !== "repaired" && result !== "unchanged") {
|
||||
return false;
|
||||
}
|
||||
const current = await inspectFileDatabaseInfo(this.core, path);
|
||||
const currentRevision = current.database.currentRevision;
|
||||
return currentRevision !== null
|
||||
? storeStorageOnRevision(path, currentRevision, false)
|
||||
: false;
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
if (metadata.revision && policy.storeVaultOnBranch) {
|
||||
revisionActions.push({
|
||||
title: $msg("Store Vault file as a child of this revision"),
|
||||
|
||||
Reference in new issue
Block a user