Skip to content

Commit d64bf59

Browse files
committed
core/intercept: do not rewrite paths when url ends in .qml
Fixes component baseUrls becoming file:// paths which cannot access singletons.
1 parent 53d69fd commit d64bf59

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/core/qsintercept.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ QUrl QsUrlInterceptor::intercept(const QUrl& url, QQmlAbstractUrlInterceptor::Da
2020
// Some types such as Image take into account where they are loading from, and force
2121
// asynchronous loading over a network. qsintercept is considered to be over a network.
2222
if (type == QQmlAbstractUrlInterceptor::DataType::UrlString && url.scheme() == "qsintercept") {
23+
// Qt.resolvedUrl and context->resolvedUrl can use this on qml files, in which
24+
// case we want to keep the intercept, otherwise objects created from those paths
25+
// will not be able to use singletons.
26+
if (url.path().endsWith(".qml")) return url;
27+
2328
auto newUrl = url;
2429
newUrl.setScheme("file");
2530
qCDebug(logQsIntercept) << "Rewrote intercept" << url << "to" << newUrl;

0 commit comments

Comments
 (0)