Bug 425177 - Dolphin refuses to open .py files located in SFTP folder.
Summary: Dolphin refuses to open .py files located in SFTP folder.
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.73.0
Platform: Arch Linux Other
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
Depends on:
Reported: 2020-08-10 05:48 UTC by Kishore Gopalakrishnan
Modified: 2020-09-21 17:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.75

Screenshot of error message (with host name blanked out) (46.27 KB, image/png)
2020-08-10 05:48 UTC, Kishore Gopalakrishnan

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2020-08-10 05:48:34 UTC
Created attachment 130746 [details]
Screenshot of error message (with host name blanked out)

Dolphin refuses to open a non-executable .py file located in an SFTP folder when one clicks on the file. (To clarify, I expect it to be opened in Kate, not executed.) Text files with other extensions (.txt, for example) can be opened without any problems.

1. In settings > configure Dolphin > confirmations, select 'Open in application'
2. Open an SFTP folder in dolphin
3. Click a .py file to open it
4. Right click on the .py file and select 'open with Kate'

After step 3, Dolphin complains that it will not open an executable for safety reasons if it is on a remote filesystem. Right clicking it to open it in Kate (step 4) works.

If the user has asked Dolphin to open executables in a text editor on clicking, the warning observed after step 3 shouldn't be shown, since the file isn't being executed.

Operating System: Arch Linux
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0
Kernel Version: 5.7.12-arch1-1

* I've attached a screenshot of the error message.
* Text files with other extensions (like .txt) can be opened by clicking as expected.
* The .py file I used doesn't have executable permissions (just 644), so I don't know why dolphin thinks it's executable.
* Downgrading `kio` to version 5.72 and restarting Dolphin fixes the issue
* I saw that the SFTP part is located in kio-extras, but I'm reporting it here since downgrading `kio` to version 5.72 fixed the issue (I didn't need to downgrade `kio-extras`)
* Reproducible on two different remote machines (different servers).
Comment 1 Kishore Gopalakrishnan 2020-08-16 10:30:45 UTC
Running a git bisect shows the bug was introduced by this commit: https://invent.kde.org/frameworks/kio/-/commit/1dc0aa9bbe9b5342773e51cf31587fb232f4c7ae
Comment 2 Bug Janitor Service 2020-09-15 14:25:19 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/136
Comment 3 Ahmad Samir 2020-09-16 17:31:50 UTC

*** This bug has been marked as a duplicate of bug 425829 ***
Comment 4 Ahmad Samir 2020-09-21 17:00:31 UTC
Git commit fdd7c47c85d5d6dbf21e05e7a0d6afcf383f1d24 by Ahmad Samir.
Committed on 21/09/2020 at 12:26.
Pushed by dfaure into branch 'master'.

OpenUrlJob: handle all text scripts consistently

Previously we only handled application/x-shellscript, but there are other
scripts; a script is technically a file that inherits both text/plain and
application/x-executable, e.g. .sh, .csh, .py, perl scripts ...etc. Treat
all those mime types the way we handled shell scripts:
  - if it's not a local url, or isn't executable we open it in the preferred
    text editor
  - if it's executable either show the OpenOrExecute dialog or execute
    directly depending on how the job is configured

The mimetype world is a confusing one:
  - Executables, this includes .exe files (MS Windows); and "application/x-executable"
    and "application/x-sharedlib", this depends on various parameters (e.g.
    stripped executables are x-sharedlib, the same executable if not stripped
    is x-executable...)
  - Scripts: shell, python, perl... etc scripts, which are text files that
    can be executed or opened as text.

Adjust the unit test.
Related: bug 425829
FIXED-IN: 5.75

M  +43   -13   autotests/openurljobtest.cpp
M  +2    -0    autotests/openurljobtest.h
M  +40   -25   src/gui/openurljob.cpp