Skip to content

Commit

Permalink
fix(GoogleDrive|WebDAV): Try to catch more errors when file is encrypted
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Jan 19, 2025
1 parent 467deb2 commit 523ba2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/adapters/GoogleDrive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ export default class GoogleDriveAdapter extends CachingAdapter {
if (this.server.password) {
try {
try {
// TODO: Use this when encrypting
const json = JSON.parse(xmlDocText)
xmlDocText = await Crypto.decryptAES(this.server.password, json.ciphertext, json.salt)
} catch (e) {
Expand All @@ -264,7 +263,8 @@ export default class GoogleDriveAdapter extends CachingAdapter {
throw new DecryptionError()
}
}
} else if (!xmlDocText || !xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>')) {
}
if (!xmlDocText || !xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>')) {
throw new FileUnreadableError()
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib/adapters/WebDav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ export default class WebDavAdapter extends CachingAdapter {
throw new DecryptionError()
}
}
} else if (!xmlDocText || (!xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>') && !xmlDocText.includes('<!DOCTYPE NETSCAPE-Bookmark-file-1>'))) {
}
if (!xmlDocText || (!xmlDocText.includes('<?xml version="1.0" encoding="UTF-8"?>') && !xmlDocText.includes('<!DOCTYPE NETSCAPE-Bookmark-file-1>'))) {
throw new FileUnreadableError()
}

Expand Down

0 comments on commit 523ba2a

Please sign in to comment.