File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -7521,8 +7521,21 @@ void QgisApp::changeDataSource( QgsMapLayer *layer )
7521
7521
const QString path = sourceParts.value( QStringLiteral( "path" ) ).toString();
7522
7522
const QString closestPath = QFile::exists( path ) ? path : QgsFileUtils::findClosestExistingPath( path );
7523
7523
dlg.expandPath( closestPath );
7524
- source.replace( path, QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( closestPath ).toString(),
7525
- path ) );
7524
+ if ( source.contains( path ) )
7525
+ {
7526
+ source.replace( path, QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( closestPath ).toString(),
7527
+ path ) );
7528
+ }
7529
+ else
7530
+ {
7531
+ // source might contain the original path using a "QUrl::FullyEncoded" encoding
7532
+ const QString uriEncodedPath = QUrl( path ).toString( QUrl::FullyEncoded );
7533
+ if ( source.contains( uriEncodedPath ) )
7534
+ {
7535
+ source.replace( uriEncodedPath, QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( closestPath ).toString(),
7536
+ uriEncodedPath ) );
7537
+ }
7538
+ }
7526
7539
}
7527
7540
dlg.setDescription( tr( "Original source URI: %1" ).arg( source ) );
7528
7541
You can’t perform that action at this time.
0 commit comments