Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrypted files from preview does not offer the right application to open the downloaded attachment #2944

Open
martgil opened this issue Feb 6, 2025 · 8 comments
Assignees
Milestone

Comments

@martgil
Copy link
Collaborator

martgil commented Feb 6, 2025

Description

FlowCrypt android app offers previewing a file before downloading. In the specific report below, they have tried to open a word file by tapping the attachment preview -> starts downloading the file -> file download completed. Once the file download is completed, it shows the file to be opened in Google Wallet or Samsung Health which is incorrect.

I don't receive all that many attachments, so it's hard to determine whether there are any patterns. I think it is possible that the problem here was that it was a docx file. I can't say for sure whether I have received any docx files before, though I think I probably have. When I go to open the file on the phone it offers me choices of Samsung Health or Google Wallet (both apps that I have never used). So I am thinking it may not recognize the microsoft extension but that seems unlikely. I know for sure that I have opened doc files before, although just now I went back to a doc file that was sent to me on Jan 14, and the same problem occrred. Maybe Microsoft has changed something that's made it incompatible in the flowcrypt for android app.

I tested the reported scenario and gave me the same result.

Steps to reproduce

  1. Received an email that contains .docx file attachment.
  2. Open the said email on your FlowCrypt Android app.
  3. Tap on attachment preview (default actions, anyway when tapping the entire attachment button - file streaming) to start downloading and invoking the app chooser.
  4. Chooser will offer Google Wallet or Samsung Health. (Defaults to Google Wallet if no other compatible app is found).

Workaround

  • Download the .docx file (or any other file attachment) by tapping the file download icon button (not preview) to download the file into the device. Open the downloaded decrypted file using the appropriate application to access them.

https://mail.google.com/mail/u/human@flowcrypt.com/#inbox/FMfcgzQZSsPWNSXvHKPxBNbMjJGnjxGc

@martgil
Copy link
Collaborator Author

martgil commented Feb 7, 2025

The user added the following comment:

I thought I was trying to download it. Maybe that works differently on phone than on computer?

This is when tapping the entire attachment file button.

Image

It behaves as if the user taps the attachment preview, which will decrypt and download the file. Unfortunately, its not very intuitive as user expects it will be downloaded. It may be different assumption with other user. I think we need to come up better approach or to carefully consider if we really need the the "clickable" attachment file button that behaves as attachment preview by default when it is tapped.

@DenBond7 DenBond7 self-assigned this Feb 7, 2025
@DenBond7 DenBond7 added this to the 1.6.2 milestone Feb 7, 2025
@DenBond7
Copy link
Collaborator

Hi @martgil,

  1. Please always add info about the reporter FlowCrypt Android app version. It will help debug the problem a lot. For example FlowCrypt Android app: 1.5.9
  2. Please test the current behavior at improve handling attachments #2948. I can't reproduce the current issue on the freshest changes.
  3. Once the file download is completed, it shows the file to be opened in Google Wallet or Samsung Health which is incorrect.

It's possible. It could be on the app side: earlier I didn't specify an attachment type -> the Android system could show the wrong apps for handling.

  1. I think we need to come up better approach or to carefully consider if we really need the the "clickable" attachment file button that behaves as attachment preview by default when it is tapped.

Agree. I've disabled "clickable" for the whole attachment view.

@martgil
Copy link
Collaborator Author

martgil commented Feb 12, 2025

Hello @DenBond7 - thanks for reviewing this bug report.

I'm sorry for not including the FlowCrypt android version when writing this issue. For me, I'm able to replicate it on app version 1.6.1 and retested it just now on that build. Against a .docx with a Microsoft Word app on my android emulator. I'll do the necessary tests to #2948 by tomorrow as I already run out of time.

@DenBond7
Copy link
Collaborator

I'll do the necessary tests to #2948 by tomorrow as I already run out of time.

Thank you, Mart. It's not urgent.

For me, I'm able to replicate it on app version 1.6.1 and retested it just now on that build.

Please share a video when you will be able

@martgil
Copy link
Collaborator Author

martgil commented Feb 13, 2025

Thanks @DenBond7. I started testing this. I'll share more details when I completed testing.

@martgil
Copy link
Collaborator Author

martgil commented Feb 13, 2025

Hello @DenBond7,

I have details on this issue now. In my testing case, the FlowCrypt android 1.6.1 that came from Play Store used to work well compared to #2948 build and I must say that there's no change the way preview attachment works. Reason is that, it must have been that the Microsoft Word android app that's no longer offer user to open streamed docx file and open it that way. The reason I said this is that, some of my apps for opening docx file where gets suggested except for MS word app. If I select the vivo document app, I can view it from there very very well.

Please kindly see the video screen recording sent via secure email.

@DenBond7
Copy link
Collaborator

@martgil Thank you for your feedback

The last changes contains the following code:

fun genViewAttachmentIntent(uri: Uri, attachmentInfo: AttachmentInfo) =

Intent() // 

we create some intent to handle preview

.setAction(Intent.ACTION_VIEW)

we set ACTION_VIEW. It means we just want to open an attachment WITHOUT the ability to modify it.

.setDataAndType(uri,..)

we specify Uri - the receiver app will use it to get access to shared data like image, text and so on.

 Intent.normalizeMimeType(attachmentInfo.type)

we specify mimeType - for example "image/jpg". It allows the Android System understand what exactly we share and what app can handle our intent (what app can open our data for preview). The system can contain a lot of apps. Every app defines capabilities via AndroidManifest.xml(<intent-filter>). For example, some app defines

<intent-filter>
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.OPENABLE" />
          <data android:mimeType="image/*" />

It means this app can open any image. Based on intent-filters the system selects and shows available apps when we want to open some data.

If a user doesn't see some apps in the provided list it means that apps have wrong settings. Or it can depend on the device manufacturer.

How can we fix it: instead of specifying some mimeType we can always send mimeType="*/*"
Pros: the system will show all available application even if some app can't handle our data. It can be a long list ))
Cons: a user will have to scroll a long list and find the needed app

instead of specifying some mimeType we can always send mimeType="*/*"

I've added these changes here #2948. You can try.

@DenBond7
Copy link
Collaborator

ref #2894 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants