Firefox pdf plugin not remembering download directory and moving files from /run/user/XXX deletes them without a trace

Keith keithw at caramail.com
Sat Nov 11 15:57:19 UTC 2023


On 11/10/23 5:15 PM, Josef Wolf wrote:
> On Wed, Nov 08, 2023 at 02:18:26PM -0600, Keith wrote:
>> On 11/8/23 11:54 AM, Josef Wolf wrote:
>>> On Wed, Nov 08, 2023 at 02:01:08PM +0100, Oliver Grawert wrote:
>>>> hi,
>>>> Am Mittwoch, dem 08.11.2023 um 13:07 +0100 schrieb Josef Wolf:
>>>>> When a pdf file is previewed in foirefox, the pdf previewer offers a
>>>>> button to
>>>>> save the file. In older installs (e.g. ubuntu-18.04, maybe prior to
>>>>> snap?) the
>>>>> dialog activated by this button remembered the directory that was
>>>>> selscted in
>>>>> previos invocations. It even remembered the directory dependant on
>>>>> the site
>>>>> the file was downloaded from.
>>>>>
>>>>> In ubuntu-22.04, this dialog always resets to something like
>>>>> /run/user/1000/XXXX/YYYY, so one has always to manually navigate to
>>>>> the last
>>>>> download directory that was used last time.
>>>>>
>>>>> Even worse: when I noticed this fact, I ran:
>>>>>
>>>>>     $ cd /some/dir/very/deep/into/the/file/hierarchy
>>>>>     $ find /run/user/1000 -name '*.pdf' -print0 | xargs -0 mv -t .
>>>>>
>>>>> to move those files to the directory they belong.
>>>>>
>>>> uh, rather do not do that since the files in /run are just mirroring
>>>> the file names ...
>>>>
>>>> snaps (including firefox) use flatpaks xdg-desktop-portals to store
>>>> files if you do not use the snap home interface ... there is some
>>>> documentation at:
>>>>
>>>> https://snapcraft.io/docs/xdg-desktop-portals#heading--portal-vs-home
>>>>
>>>> and here s the upstream doc:
>>>>
>>>> https://flatpak.github.io/xdg-desktop-portal/
>>>
>>> Uh!
>>>
>>> Then, this "feature" should be disbaled/vanished completely, alltogether!
>>>
>>> Such insane behaviour shoud net be enabled by default at all!
>>>
>>> Myself was with linux/ubuntu for decades now. Never seen such insanity! Looks
>>> like I should look out for some snap-free alternative...
>>>
>>>
>>
>> I use the Firefox snap with 22.04.3, and I don't see the behavior you're
>> experiencing. On my system, Firefox works for me just as the way you
>> described how the earlier non-snap versions worked for you.
> 
> You use "standard" folders like ~/Documents ~/.Pictures and so on?

Yes, and those are what I assumed that you were saving to from your 
first post. I *can* replicate the file-chooser behavior you see when 
saving a file (any file, not just pdfs) to folders that should be 
restricted by the snap's confinement policy (outside of the sandbox). 
Those include most hidden directories under $HOME and most directories 
and volumes outside of $HOME that aren't on removable media. For 
instance, if I choose to save a pdf to /tmp, it'll work (although I'm 
not sure why unless its through the System Files interface), but the 
next time I save a file, the file-chooser will bring up that 
/run/1000... directory which is the document portal path instead of the 
real path.

I believe that it is related to this bug:
https://github.com/flatpak/xdg-desktop-portal/issues/1120

Not going to pretend to understand the implementation of the 
xdg-desktop-portal program, so I could be wrong about the issue, but the 
bug above was present in versions < 1.18.0 and just recently fixed in 
October. Jammy has version 1.14.1 so it's going to be affected if you 
save files outside of the sandbox (above mentioned volumes and 
directories). Mantic has version 1.18.0,so the issue is fixed, perhaps?

I don't save files from Firefox outside of $HOME or removable media, so 
I forgotten this bug ever existed. But, yeah it's there :)

-- 
Keith




More information about the ubuntu-users mailing list