kdecore: fix bug where KUrl::setPath() can set "file" scheme unnecessaraly

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-04-24 17:50:43 +00:00
parent 8273d7f32e
commit d1c90f17ea

View file

@ -1460,7 +1460,7 @@ QString KUrl::relativeUrl(const KUrl &base_url, const KUrl &url)
void KUrl::setPath( const QString& _path ) void KUrl::setPath( const QString& _path )
{ {
if ( scheme().isEmpty() ) if ( scheme().isEmpty() && !_path.startsWith( QLatin1String("file:/") ) )
setScheme( QLatin1String( "file" ) ); setScheme( QLatin1String( "file" ) );
QString path = KShell::tildeExpand( _path ); QString path = KShell::tildeExpand( _path );
if (path.isEmpty()) if (path.isEmpty())