From 437e041e710b3b860664ddc6cf93d3553666c5b3 Mon Sep 17 00:00:00 2001 From: fyears Date: Sat, 11 Dec 2021 23:25:48 +0800 Subject: [PATCH] fix var in dropbox --- src/remoteForDropbox.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/remoteForDropbox.ts b/src/remoteForDropbox.ts index 1f39851..9ba6129 100644 --- a/src/remoteForDropbox.ts +++ b/src/remoteForDropbox.ts @@ -26,6 +26,10 @@ export const DEFAULT_DROPBOX_CONFIG = { export const getDropboxPath = (fileOrFolderPath: string, vaultName: string) => { let key = fileOrFolderPath; + if (fileOrFolderPath === "/" || fileOrFolderPath === "") { + // special + key = `/${vaultName}`; + } if (!fileOrFolderPath.startsWith("/")) { // then this is original path in Obsidian key = `/${vaultName}/${fileOrFolderPath}`; @@ -320,6 +324,7 @@ export class WrappedDropboxClient { path: `/${this.vaultName}`, }); console.log(`remote folder /${this.vaultName} created`); + this.vaultFolderExists = true; } else { // console.log(`remote folder /${this.vaultName} exists`); } @@ -541,6 +546,8 @@ export const downloadFromRemote = async ( password: string = "", remoteEncryptedKey: string = "" ) => { + await client.init(); + const isFolder = fileOrFolderPath.endsWith("/"); await mkdirpInVault(fileOrFolderPath, vault);