Bug 340418

Summary: Local files are treated as URLs when placed on command line
Product: [Applications] gwenview Reporter: Luca Beltrame <lbeltrame>
Component: generalAssignee: Gwenview Bugs <gwenview-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: hrvoje.senjan, lukas, myriam
Priority: NOR    
Version First Reported In: Git (add output of "git log -1 --oneline" to description)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Luca Beltrame 2014-10-28 06:38:20 UTC
In recent Gwenview master, local files are handled like http:// urls when loading them from the command line.

 As an example, 

gwenview foo.jpg

will make gwenview appear with

http://foo.jpg 

in its address bar, causing loading to fail.
This is probably an issue with the use of QUrl in the code,  Perhaps solutions like the ones outlined in http://lists.kde.org/?t=141358591200002&r=1&w=2 or using 

 QUrl::url(QUrl::PreferLocalFile)

if possible.

Reproducible: Always

Steps to Reproduce:
1. Launch gwenview from a terminal with one file 


Actual Results:  
File path is transformed into http://<file name>

Expected Results:  
http should not be prepended to the path
Comment 1 Lukáš Tinkl 2014-10-29 13:54:54 UTC
Git commit 7d6bca74c699150e1ed1ee801da98a3bb5f00d95 by Lukáš Tinkl.
Committed on 29/10/2014 at 13:52.
Pushed by lukas into branch 'master'.

fix "Local files are treated as URLs when placed on command line"

treat URLs w/o a scheme and w/o a leading slash as relative file paths;
on Qt 5.4 use the correct augmented version of
QUrl::fromUserInput(input, cwd)

M  +12   -2    app/main.cpp

http://commits.kde.org/gwenview/7d6bca74c699150e1ed1ee801da98a3bb5f00d95