Open hifi opened 2 weeks ago
@t-h-e
Adding the check is easy. Can anyone tell me how to check the header though? Is there a method that does check for a kdbx header already?
KeePass2Reader::readDatabase
reads the signature before reading the database. A small refactor to split that functionality out to a different method would allow using KeePass2Reader to just verify the signature and get the error if it fails.
The test could also just show a different success message if the command succeeds but no file is downloaded to indicate no errors happened but nothing was downloaded either.
We have a method to only read the public headers. That'll suffice.
https://github.com/keepassxreboot/keepassxc/blob/develop/src%2Fgui%2FDatabaseOpenWidget.cpp#L228
@droidmonkey thanks. I have added a check. @hifi can you have a look?
Overview
At least when using the "Test" button the test is successful if the command succeeds and creates either a file or a directory.
Steps to Reproduce
{TEMP_DATABASE}
Expected Behavior
The file must exist and have a KDBX header, no other result should be accepted. Testing against an empty remote will fail but that might be good as long as the error (stdout + stderr) is displayed.
Actual Behavior
An empty directory is accepted as a successful download or any file that isn't necessarily a database.