flathub / org.gimp.GIMP

https://flathub.org/apps/details/org.gimp.GIMP
27 stars 17 forks source link

Can't open image from Firefox #136

Closed suilno closed 2 years ago

suilno commented 2 years ago

I'm using Xubuntu 20.04, Firefox 96.0.2 (.deb), GIMP 2.10.30 (flatpak) and flatpak 1.12.4.

When downloading an image in Firefox and choosing the "open with" option and selecting GIMP, the download is performed, but the image does not open in GIMP and nothing happens. The image, however, is stored in a temporary folder.

Steps to reproduce:

  1. Open a page with option to download image (eg: https://unsplash.com/photos/7xX02q5ktys);
  2. Click to download;
  3. In the Firefox's popup window, choose the "open with" option;
  4. Select GIMP and wait for the image to open;
  5. Nothing happens.
Jehan commented 2 years ago

It does open with GIMP successfully when you use "open with" from a file manager?

suilno commented 2 years ago

Yes, I can open the image in GIMP with "open with" from the file manager (Thunar) context menu.

Jehan commented 2 years ago

Then it does look like a problem in Firefox. The "open with" feature works through the desktop file (which advertizes which formats are supported and how files must be opened by a given application). It's the same thing for flatpak applications which also use desktop files (they just tweak the command a bit). If the same desktop file works with one application (Thunar), not another (Firefox), it's possibly how Firefox uses the file? Or maybe they don't implement the feature same as others?

Jehan commented 2 years ago

Ah wait, just as I posted, I thought of something maybe. You say that the file is in a temp folder. Maybe flatpaked GIMP simply doesn't have access to this folder.

Which folder is it? Is it in /tmp/? (because our flatpak is supposed to have access to /tmp/)

And when you tested "Open with" in Thunar, did you test in this same folder or a random image from your home? Because I am guessing that maybe "Open with" in Thunar would not work either when run from this temp folder. Could you test?

suilno commented 2 years ago

Which folder is it? Is it in /tmp/? (because our flatpak is supposed to have access to /tmp/)

Firefox stores the image in /tmp/mozilla_lucas0/, and I confirmed (in Flatseal) that GIMP have access allowed to the /tmp/ folder indeed.

And when you tested "Open with" in Thunar, did you test in this same folder or a random image from your home? Because I am guessing that maybe "Open with" in Thunar would not work either when run from this temp folder. Could you test?

I tested it with the same image, in the same folder. The "open with" in Thunar works as expected, the problem persists in Firefox.

A curious detail is that, on the second attempt to open the image in Firefox, the GIMP name, that I had selected before, simply becomes "flatpak":

Captura de tela_2022-01-21_14-33-31

Jehan commented 2 years ago

Yeah I think you should report this to Firefox (someone might already have), though Flatpak might still be considered a corner case (I don't know if that's the case for Firefox developers). Maybe the way they call other applications is not implemented same as other software do.

I would test too, but I am currently running Firefox itself from Flatpak so it doesn't even have access to other applications anyway (which also sucks a lot).

Jehan commented 2 years ago

Ok actually I was very curious, so I did install the distribution package of Firefox (78.14.0ESR) and I could confirm the problem when GIMP is installed as Flatpak (also at next try, it also displays just "flatpak" in the dropdown, same as you).

Though as predicted, it's not only with GIMP. For instance I tried to install MyPaint too as a normal package → works flawlessly. Then I uninstalled the .deb package and installed the Flatpak package → same issue (not running MyPaint, then displays "flatpak" on next try).

So it really looks like something is wrong in how Firefox calls the third-party application and somehow it manifests when the applications are flatpak-ed.

suilno commented 2 years ago

I also tested opening the image with other flatpak programs and verified this. It works just fine with .deb programs, however. The problem really seems to be the way Firefox handles flatpak.

Thanks a lot for the help, @Jehan! I'm going to close this issue because, as we can see, the problem is not with GIMP exactly.

Jehan commented 2 years ago

@suilno Just for information though, I'd appreciate if you could post here the bug report link if you open one at Firefox'. I'd be interested to subcribe and follow this report as well, to check on the progression of a solution.

Thanks!

suilno commented 2 years ago

Here's the bug report on Mozilla's Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1751467