summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2019-05-29 18:02:19 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2019-06-03 12:29:49 +0000
commit8c7589d992a5615fa3a98f67d098d5a2fca579cb (patch)
tree7953de8458635b59fcd725a15432be95fd2e16d8 /src/corelib
parent6f40331058071e628e83e74c7f2032e41b1a3f3d (diff)
Do not strip off the fragment and query in the qfileselector
This is needed for cases where we use e.g. "file:///test.html?query#Fragment". The fragment and query were already preserved for the qrc scheme. This fixes it for the file scheme. Change-Id: I5713e4a25372fdd55ac255b1c6228b4dea419244 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfileselector.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index ce06c8e00b..500b475d1d 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -228,7 +228,18 @@ QUrl QFileSelector::select(const QUrl &filePath) const
QString selectedPath = d->select(equivalentPath);
ret.setPath(selectedPath.remove(0, scheme.size()));
} else {
+ // we need to store the original query and fragment, since toLocalFile() will strip it off
+ QString frag;
+ if (ret.hasFragment())
+ frag = ret.fragment();
+ QString query;
+ if (ret.hasQuery())
+ query= ret.query();
ret = QUrl::fromLocalFile(d->select(ret.toLocalFile()));
+ if (!frag.isNull())
+ ret.setFragment(frag);
+ if (!query.isNull())
+ ret.setQuery(query);
}
return ret;
}