mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2024-12-15 09:14:07 +02:00
- Fixed:
- No more infinity loops on larger files. - Show message on decode error. - Refactored: - Fixed to avoid obsolete global variables.
This commit is contained in:
parent
279b4b41e5
commit
bb4b764586
2
src/lib
2
src/lib
@ -1 +1 @@
|
||||
Subproject commit 2ea80a40c11c367efcb6861dbf3c4ee076b705b9
|
||||
Subproject commit f9aeaf6a2d8cb42deafc0bd89d6a43b4654d18fd
|
@ -1306,9 +1306,9 @@ Note: We can always able to read V1 format. It will be progressively converted.
|
||||
try {
|
||||
let outFile;
|
||||
if (mode == "create") {
|
||||
outFile = await createFile(normalizePath(path), writeData, { ctime: doc.ctime, mtime: doc.mtime, });
|
||||
outFile = await createFile(this.app,normalizePath(path), writeData, { ctime: doc.ctime, mtime: doc.mtime, });
|
||||
} else {
|
||||
await modifyFile(file, writeData, { ctime: doc.ctime, mtime: doc.mtime });
|
||||
await modifyFile(this.app,file, writeData, { ctime: doc.ctime, mtime: doc.mtime });
|
||||
outFile = getAbstractFileByPath(getPathFromTFile(file)) as TFile;
|
||||
}
|
||||
Logger(msg + path);
|
||||
|
@ -303,14 +303,14 @@ export function flattenObject(obj: Record<string | number | symbol, any>, path:
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function modifyFile(file: TFile, data: string | ArrayBuffer, options?: DataWriteOptions) {
|
||||
export function modifyFile(app: App, file: TFile, data: string | ArrayBuffer, options?: DataWriteOptions) {
|
||||
if (typeof (data) === "string") {
|
||||
return app.vault.modify(file, data, options);
|
||||
} else {
|
||||
return app.vault.modifyBinary(file, data, options);
|
||||
}
|
||||
}
|
||||
export function createFile(path: string, data: string | ArrayBuffer, options?: DataWriteOptions): Promise<TFile> {
|
||||
export function createFile(app: App, path: string, data: string | ArrayBuffer, options?: DataWriteOptions): Promise<TFile> {
|
||||
if (typeof (data) === "string") {
|
||||
return app.vault.create(path, data, options);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user