Skip to content

Commit 523ba2a

Browse files
committed
fix(GoogleDrive|WebDAV): Try to catch more errors when file is encrypted
Signed-off-by: Marcel Klehr <[email protected]>
1 parent 467deb2 commit 523ba2a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/lib/adapters/GoogleDrive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ export default class GoogleDriveAdapter extends CachingAdapter {
250250
if (this.server.password) {
251251
try {
252252
try {
253-
// TODO: Use this when encrypting
254253
const json = JSON.parse(xmlDocText)
255254
xmlDocText = await Crypto.decryptAES(this.server.password, json.ciphertext, json.salt)
256255
} catch (e) {
@@ -264,7 +263,8 @@ export default class GoogleDriveAdapter extends CachingAdapter {
264263
throw new DecryptionError()
265264
}
266265
}
267-
} else if (!xmlDocText || !xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>')) {
266+
}
267+
if (!xmlDocText || !xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>')) {
268268
throw new FileUnreadableError()
269269
}
270270

src/lib/adapters/WebDav.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ export default class WebDavAdapter extends CachingAdapter {
227227
throw new DecryptionError()
228228
}
229229
}
230-
} else if (!xmlDocText || (!xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>') && !xmlDocText.includes('<!DOCTYPE NETSCAPE-Bookmark-file-1>'))) {
230+
}
231+
if (!xmlDocText || (!xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>') && !xmlDocText.includes('<!DOCTYPE NETSCAPE-Bookmark-file-1>'))) {
231232
throw new FileUnreadableError()
232233
}
233234

0 commit comments

Comments
 (0)