Skip to content

Commit

Permalink
Core: LocalSystem: properly handle Windows UNC paths in Path::shrink()
Browse files Browse the repository at this point in the history
Closes #65.
  • Loading branch information
tobydox committed Dec 8, 2016
1 parent daa4d3c commit f7230b1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/src/LocalSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,15 @@ QString Path::shrink( QString path )
path.replace( QDTNS( QDir::tempPath() ), envVar.arg( "TEMP" ) );
}

return QDTNS( path.replace( QString( "%1%1" ).
arg( QDir::separator() ), QDir::separator() ) );
// remove duplicate directory separators - however skip the first two chars
// as they might specify an UNC path on Windows
if( path.length() > 3 )
{
return QDTNS( path.left( 2 ) + path.mid( 2 ).replace(
QString( "%1%1" ).arg( QDir::separator() ), QDir::separator() ) );
}

return QDTNS( path );
}


Expand Down

0 comments on commit f7230b1

Please sign in to comment.