Bug 452968 - The Save File window sometimes forgets last used directory when it was a kio-fuse mount path
Summary: The Save File window sometimes forgets last used directory when it was a kio-...
Status: RESOLVED FIXED
Alias: None
Product: xdg-desktop-portal-kde
Classification: Unclassified
Component: general (show other bugs)
Version: 5.24.4
Platform: Neon Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-25 01:27 UTC by redashesyellowflowers
Modified: 2022-04-25 20:59 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description redashesyellowflowers 2022-04-25 01:27:07 UTC
SUMMARY
***
The Save File - KDialog window sometimes forgets the last directory to which it was pointing, even when the browser's cache was not cleaned. Observed across Brave and Firefox browsers. Also seen on KDE Neon 20.04 and Fedora 35.
***


STEPS TO REPRODUCE
1. Open Browser (Brave/Firefox), and attempt to save a file to a non-standard download location (i.e. not the Downloads folder).
2. Wait a few minutes or more.
3. Try to save another file and instead you will be directed to /run/user/1000/doc/random-characters-folder/ which contains a copy of the saved file.


OBSERVED RESULT
When I try to save a file a second time, I expect to see the directory where I last saved a file. 


EXPECTED RESULT
But the KDialog seems to save the file in two places. One in the directory where I want it to and secondly in a sub-folder in /run/user/1000/doc/ . From then on, the browser's default download location becomes that folder. Every time I try to save a file, I end up in /run/user/1000/doc/xxx/. 

This is very annoying.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: KDE Neon 20.04 and Fedora 35.
(available in About System)

[This is for Fedora 35]
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2022-04-25 16:53:30 UTC
The dialog itself has no memory; it's up to the browser itself to remember the last-visited location and open the dialog there.

However in this case the symptoms indicate that they are remembering it, but there's a bug on out side that causes the past to be changed from what you expect it to be. I believe this will be fixed with https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/84.
Comment 2 Harald Sitter 2022-04-25 20:55:44 UTC
Git commit 390731d731b610e23650c300ac07453ae33fb521 by Harald Sitter.
Committed on 25/04/2022 at 19:12.
Pushed by ngraham into branch 'master'.

reverse url fusing

this actually was defective even with local urls...
as we pass files through the portal the sandbox gets irrelevant portal
paths a la /run/foo/bar/yolo.txt when the sandbox then gives us that
path back, the directory isn't meant to be written to, much less shown
to the user to begin with.

to deal with this scenario we now do a reverse resolution dance on
savefile. notably we first ask the portal to translate the portal file
name in /run to the actual file name underneath it. we then run that
path through kio-fuse in case it was fuse mounted

this renders /run to /home/foo/yolo.txt or when it was fuse mounted for
example smb:///foo/yolo.txt

the effective end result is that when you open a file in okular from a
samba share and then save-as, the file save dialog will show the smb://
url not the fake /run url

A  +18   -0    data/org.freedesktop.portal.Documents.xml
M  +3    -0    src/CMakeLists.txt
M  +66   -3    src/filechooser.cpp

https://invent.kde.org/plasma/xdg-desktop-portal-kde/commit/390731d731b610e23650c300ac07453ae33fb521