Kunzisoft / KeePassDX

Lightweight vault and password manager for Android, KeePassDX allows editing encrypted data in a single file in KeePass format and fill in the forms in a secure way.
https://www.keepassdx.com/
GNU General Public License v3.0
4.79k stars 276 forks source link

Attachments want to open with KeePassDX for all file extensions #825

Open irplus-remote opened 3 years ago

irplus-remote commented 3 years ago

When i click on an attachment in GMAIL with my own file extension (which is *.irplus) it suggests to open with KeePassDX (in addition to my app). This is not a serious thing, but probably the intent for detecting keepass files is too greedy ;)

J-Jamet commented 3 years ago

What do you mean by "not a serious thing"? A keepass file can inherently have any extension so the intent filter looks at the same type of file or .kdb / .kdbx extension. If it is a file with the mime-type application/octet-stream or application/x-kdb or application/x-kdb or application/x-keepass, the mime-type is compatible with KeePassDX. What mime-type are you using for your files?

irplus-remote commented 3 years ago

"not a serious thing" I meant, that if it can't be fixed, it's nothing to worry about.

I'm using a custom mime-type for my own file which is application/irplus. But my app aside..

Lets say I send a file called "test.foo" and you click on the attachment in GMAIL it will suggest to open with KeePassDX as well.. Basically it seems it wants to open any file extension as you said.

Would it not be more reasonable to only suggest to open kdb or kdbx file extensions? If a user really would like to open a "foo" file with KeePassDX he still can do so by selecting it in a File manager.

J-Jamet commented 3 years ago

Would it not be more reasonable to only suggest to open kdb or kdbx file extensions?

Limiting the filter to extensions is not a good idea because users who have changed their extensions should not have the same behavior. But on the other hand, KeePassDX shouldn't be offered with a file containing your mime-type application/irplus, that's weird.

The manifest is well configured for: https://github.com/Kunzisoft/KeePassDX/blob/0761d356b8f2a0911c400932d5a2642bf5d7217a/app/src/main/AndroidManifest.xml#L82

Tell me if there is a mistake.

irplus-remote commented 3 years ago

I think application/octet-stream with any extension is too greedy. Basically if someone wants to hide his database by using a weird extension like "foo" , it would be even more reasonable to no offer KeePassDX to make for a better disguise. Or what else should be the reason for one to rename the kdb/kdbx file?

But this is my own thought only, if there's a reason, i guess it can be left like it is, dont want to be responsible for user complaints :D

Ill also play around a bit with my own intent if i can make it at least to disappear in the list for *.irplus somehow.

J-Jamet commented 3 years ago

In a way you are right, I will do several tests to see if there is any side effect if I remove the recognition of application/octet-stream.

J-Jamet commented 3 years ago

application/octet-stream does not define a particular type but a data stream which is very useful for KeePassDX in the event that the content-provider of the application providing the file cannot actually provide the actual mime-type. For example, the download folder reference of the default file manager. In this case, the program asks the user what the correct program is, so it's not really a problem. If the mime-type is given by the content -provider, the correct application is automatically selected.

irplus-remote commented 3 years ago

This is only the case when the extension is not being provided (kdb/kdbx). In case the program cannot determine the mime-type it will probably use application/octet-stream but your other intent for the file extension will match and thus will display KeePassDX as expected. Just by "grabbing" all application/octet-stream files with a different extension other than kdb/kdbx does still feel a bit "greedy".

In this case, the program asks the user what the correct program is, so it's not really a problem

Yes but it will only ask to open with KeePassDX, which feels a bit wrong, only when I choose "Other". (At least this is the behaviour with CX File Explorer. I will now make some tests with some other phones as well.. Just to exclude a misbehaviour from the Explorer

J-Jamet commented 3 years ago

This is only the case when the extension is not being provided (kdb/kdbx). In case the program cannot determine the mime-type it will probably use application/octet-stream but your other intent for the file extension will match and thus will display KeePassDX as expected.

I just tested with files that do have the extension, and it doesn't work if I remove the application/octet-stream from the manifest (when selecting the file from the download folder reference with Android R). I think the File app only gives this mime type at this level. Tell me if I'm wrong.

mime-type