Bug 473167

Summary: Dolphin allows renaming files that you do not have permissions to on an sftp connection
Product: [Applications] dolphin Reporter: Antti Savolainen <antti.savo>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: kfm-devel, meven29
Priority: NOR    
Version First Reported In: 23.04.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Antti Savolainen 2023-08-08 18:36:45 UTC
SUMMARY
Demonstrative video: https://www.youtube.com/watch?v=ickDqRwjwRg
When I connect to another computer with sftp, all of the files are renameable according to the context menu. If I press enter to submit the new name, I get an access error but the name stays displayed on the file. Neither of these should be happening

STEPS TO REPRODUCE
1. Connect to another computer with sftp
2. Edit a filename that you don't have write permissions to

OBSERVED RESULT
The rename button is not greyed out like it is locally and after getting an "Access denied" error, the name edited name stays displayed

EXPECTED RESULT
Editing the name should not be possible if you do not have permissions but also, the name should revert to original after getting the error as a backup method.

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Comment 1 Méven Car 2023-08-22 14:36:38 UTC
Technical explanation:

We KFileItemListProperties::supportsMoving to determine if files can be renamed, but this does support the !local path of sftp:// protocol.
Adding this support there would mean adding a synchronous KIO::stat for a remote target, which can block the UI.
On the other hand Dolphin has a cache of the file hierarchy in its model, that could be used to determine this.