mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-31 06:19:42 +08:00
🐛 Fix(custom): fix webdav backup bug for custom path close #347
This commit is contained in:
@@ -141,7 +141,15 @@ async function uploadLocalToRemote(syncConfig: ISyncConfig, fileName: string) {
|
||||
}
|
||||
const client = createClient(webdavEndpointF, options)
|
||||
const fileContent = fs.readFileSync(localFilePath)
|
||||
const remoteFilePath = webdavSavePath ? path.join(webdavSavePath, fileName) : fileName
|
||||
const remoteFilePath = webdavSavePath
|
||||
? `${webdavSavePath}/${fileName}`.replace(/^\/+|\/+$/g, '').replace(/\/\/+/g, '/')
|
||||
: fileName
|
||||
console.log('remoteFilePath', remoteFilePath)
|
||||
const remoteDir = path.dirname(remoteFilePath)
|
||||
console.log('remoteDir', remoteDir)
|
||||
if (remoteDir !== '/') {
|
||||
await client.createDirectory(remoteDir, { recursive: true })
|
||||
}
|
||||
await client.putFileContents(remoteFilePath, fileContent, { overwrite: true })
|
||||
return true
|
||||
}
|
||||
@@ -255,7 +263,13 @@ async function updateLocalToRemote(syncConfig: ISyncConfig, fileName: string) {
|
||||
}
|
||||
const client = createClient(webdavEndpointF, options)
|
||||
const fileContent = fs.readFileSync(localFilePath)
|
||||
const remoteFilePath = webdavSavePath ? path.join(webdavSavePath, fileName) : fileName
|
||||
const remoteFilePath = webdavSavePath
|
||||
? `${webdavSavePath}/${fileName}`.replace(/^\/+|\/+$/g, '').replace(/\/\/+/g, '/')
|
||||
: fileName
|
||||
const remoteDir = path.dirname(remoteFilePath)
|
||||
if (remoteDir !== '/') {
|
||||
await client.createDirectory(remoteDir, { recursive: true })
|
||||
}
|
||||
await client.putFileContents(remoteFilePath, fileContent, { overwrite: true })
|
||||
return true
|
||||
}
|
||||
|
||||
4
src/universal/types/i18n.d.ts
vendored
4
src/universal/types/i18n.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
interface ILocales {
|
||||
LANG_DISPLAY_LABEL: string
|
||||
ABOUT: string
|
||||
OPEN_MAIN_WINDOW: string
|
||||
OPEN_MINI_WINDOW: string
|
||||
@@ -9,6 +10,7 @@ interface ILocales {
|
||||
UPLOAD_FAILED: string
|
||||
UPLOAD_PROGRESS: string
|
||||
OPERATION_SUCCEED: string
|
||||
OPERATION_FAILED: string
|
||||
UPLOADING: string
|
||||
QUICK_UPLOAD: string
|
||||
UPLOAD_BY_CLIPBOARD: string
|
||||
@@ -925,6 +927,8 @@ interface ILocales {
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: string
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: string
|
||||
TIPS_PICGO_BACKUP_FILE_VERSION: string
|
||||
TIPS_SHORTCUT_MODIFIED_SUCCEED: string
|
||||
TIPS_SHORTCUT_MODIFIED_CONFLICT: string
|
||||
TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR: string
|
||||
TIPS_FIND_NEW_VERSION: string
|
||||
UPDATE_DOWNLOADED: string
|
||||
|
||||
Reference in New Issue
Block a user