Bug 363297

Summary: kate/kwrite don't accept the file:/// protocol in URL
Product: [Applications] kate Reporter: Antonio Rojas <arojas>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph, lemaitre.dulotus
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Antonio Rojas 2016-05-19 20:47:09 UTC
kate and kwrite don't open files if their URL is specified via the file:// protocol. The "file://" part is interpreted as part of the file path. It doesn't affect other KDE applications, only kate and kwrite.

Reproducible: Always

Steps to Reproduce:
1. Run "kate file:///home/foo/bar.txt"


Actual Results:  
It opens a new file in the path "$PWD/file:///home/foo/bar.txt"

Expected Results:  
It opens /home/foo/bar.txt
Comment 1 Christoph Cullmann 2016-05-28 19:54:18 UTC
Git commit 10dc8c4d44427b0f7444a447fc2085d2d8e08135 by Christoph Cullmann.
Committed on 28/05/2016 at 19:54.
Pushed by cullmann into branch 'master'.

fix that kate/kwrite don't accept the file:/// protocol in URL on command line

M  +13   -6    urlinfo.h

http://commits.kde.org/kate/10dc8c4d44427b0f7444a447fc2085d2d8e08135
Comment 2 Antonio Rojas 2016-05-28 21:50:05 UTC
Still not working right. Now the 'file://" part is trimmed, but the url is still appended to the current path instead of being interpreted as an absolute path. 
Also, the url needs to be percent-decoded so that something like 'kate file://home/me/test%20file.txt' works.
Comment 3 Christoph Cullmann 2016-05-29 13:44:15 UTC
>  but the url is still appended to the current path instead of being interpreted as an absolute path.
this is not true, it is only made absolute with current path.

e.g. file://lala.txt will open pwd/lala.txt in pwd
e.g. file:///tmp/lala.txt will open /tmp/lala.txt

that works like it should now.

But you are right with the encoding issue ;)
Comment 4 Christoph Cullmann 2016-05-29 14:57:34 UTC
Git commit 4a08e84c9060db42fa5fbf01f802273e025028ba by Christoph Cullmann.
Committed on 29/05/2016 at 14:56.
Pushed by cullmann into branch 'master'.

redo the command line path handling
use the new function of Qt 5.4 that allows to specify local files as fallback and working directory
add an second level of fallback: invalid url => try local file
fixup the :line:column matching code to not destroy file:/// urls

M  +60   -27   urlinfo.h

http://commits.kde.org/kate/4a08e84c9060db42fa5fbf01f802273e025028ba