I found this question about the same topic: Is there a setting to make Firefox not directly download PDFs to Downloads when using "Open With"?
A solution is given there but there is also a warning that "if you are using snap package, this might cause issues with temp folders". Apparently I am using a snap package because it says "Mozilla Firefox Snap for Ubuntu" in the About Firefox section.
So I am wondering if there is another solution which might work in my case?
I don't know anything about the difference between snap packages and other kinds of packages or whether you can actually choose between them, I just installed Ubuntu 22.04 on my desktop computer and 24.04 on my laptop and I am having the same problem on both machines. It wasn't a problem before on my Ubuntu 16.04 machine so I assume snap is something new that has been invented in the meantime.
Thank you very much in advance for any suggestions. Please explain things in detail as my technical knowledge and understanding is limited.