Open Bug 1515440 Opened 6 years ago Updated 2 years ago

Issue to PromptDelegate.FileCallback.confirm not handling URIs from content://com.android.providers

Categories

(GeckoView :: General, enhancement, P3)

All
Android
enhancement

Tracking

(Not tracked)

People

(Reporter: amejia, Unassigned)

Details

(Whiteboard: [geckoview:2023?])

I'm implementing onFilePrompt(GeckoSession session, String title, int type, String[] mimeTypes, FileCallback callback) from GeckoSession and I'm having some issues with GeckoSession.PromptDelegate.FileCallback when calling void confirm(Context context, Uri uri); with an URI from the Android File Chooser, I get a log saying "Only file URI is supported" but when I do the same exercise with the Webview API it works without any problems.

It is only working with URIs that are from the photo app, below an example of which one pass and fail.

Pass
content://com.google.android.apps.photos.contentprovider/0/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F13845/ORIGINAL/NONE/934029267

Fail `"Only file URI is supported"`
content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Fimg_20181201_143745~2.jpg

Another issue is that when I select an image from the photo gallery, the name of the file is shown in the input type file but when pressing the submit button to upload the file, it does nothing and the input type file button doesn't work anymore, it doesn't call to onFilePrompt anymore.
Product: Firefox for Android → GeckoView
Dylan says he can look at this bug because he's working on some other PromptDelegate issues.
Assignee: snorp → droeh
Priority: -- → P1
Awesome!

Just hopping in to flag that we are exploring a GV implementation of Firefox Send for Android and this appears to be a blocker for us. Do you have an ETA on this work?

Flags: needinfo?(droeh)
Flags: needinfo?(cpeterson)

I've been preoccupied with some other bugs; I should be able to start seriously investigating this bug later this week or next week.

Flags: needinfo?(droeh)
Flags: needinfo?(cpeterson)

(In reply to [:jgruen] from comment #3)

Just hopping in to flag that we are exploring a GV implementation of Firefox Send for Android and this appears to be a blocker for us. Do you have an ETA on this work?

No ETA at this time. This bug is not on the GV team's 2019 H1 roadmap because it doesn't block Fenix MVP.

(In reply to Arturo Mejia from comment #2)

Awesome!

Did you find a workaround on this?

[:jgruen] a workaround could be done using a temp file or cache.

That will also allow any file from any source (including online sources) to be used/sent.

////////////////

    File myFile = new File(this.getFilesDir(),"temp.cube");

    try {
        FileInputStream in = (FileInputStream) getContentResolver().openInputStream(data.getData());
        FileOutputStream out = new FileOutputStream(myFile);
        FileChannel inChannel = in.getChannel();
        FileChannel outChannel = out.getChannel();
        inChannel.transferTo(0, inChannel.size(), outChannel);
        in.close();
        out.close();
    } catch (Exception e) {}

    final Uri uri = Uri.parse("file:///"+myFile.getAbsolutePath());
    callback.confirm(this, uri);

/////////////////

Thanks @colormath, the workaround is working!

This is probably pretty close to what we'd be doing in GeckoView anyway, so seems like a reasonable way to go until this is fixed.

I'm editing a bunch of GeckoView bugs. If you'd like to filter all this bugmail, search and destroy emails containing this UUID:

e88a5094-0fc0-4b7c-b7c5-aef00a11dbc9

Priority: P1 → P2
Rank: 20

The bug assignee didn't login in Bugzilla in the last 7 months.
:amoya, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: droeh → nobody
Flags: needinfo?(amoya)
Priority: P2 → P3
Whiteboard: [geckoview:2023?]

Makoto says this bug has a workaround that browser app resolves content:// data by own (using content provider) then pass it.

Flags: needinfo?(amoya)
Severity: normal → S3
Rank: 20 → 333

Tasks and enhancements should have severity N/A.

Severity: S3 → N/A
You need to log in before you can comment on or make changes to this bug.