allow the private imports relative to alloewdPath
This commit is contained in:
parent
c97611dfac
commit
20906f6b0d
@ -111,6 +111,7 @@ void ConfigViewPrivate::init()
|
|||||||
|
|
||||||
if (corona->package().isValid()) {
|
if (corona->package().isValid()) {
|
||||||
PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(q->engine(), corona->package());
|
PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(q->engine(), corona->package());
|
||||||
|
qWarning()<<"AAAA"<<interceptor;
|
||||||
interceptor->addAllowedPath(applet.data()->package().path());
|
interceptor->addAllowedPath(applet.data()->package().path());
|
||||||
q->engine()->setUrlInterceptor(interceptor);
|
q->engine()->setUrlInterceptor(interceptor);
|
||||||
}
|
}
|
||||||
|
@ -129,10 +129,10 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
|
|||||||
QString pathCheck(path.path());
|
QString pathCheck(path.path());
|
||||||
pathCheck = pathCheck.replace(QRegExp(".*org/kde/plasma/private/(.*)/.*"), "org.kde.plasma.\\1");
|
pathCheck = pathCheck.replace(QRegExp(".*org/kde/plasma/private/(.*)/.*"), "org.kde.plasma.\\1");
|
||||||
|
|
||||||
if (pathCheck == m_package.metadata().pluginName()) {
|
if (pathCheck == m_package.metadata().pluginName() || allowed.contains(pathCheck)) {
|
||||||
return path;
|
return path;
|
||||||
} else {
|
} else {
|
||||||
return QUrl("file://" + allowed + "/org/kde/plasma/accessdenied/qmldir");
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//it's from an allowed, good
|
//it's from an allowed, good
|
||||||
@ -141,6 +141,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return QUrl("file://" + allowedPaths.first() + "/org/kde/plasma/accessdenied/qmldir");
|
||||||
}
|
}
|
||||||
|
|
||||||
qWarning() << "WARNING: Access denied for URL" << path << m_package.path();
|
qWarning() << "WARNING: Access denied for URL" << path << m_package.path();
|
||||||
|
Loading…
Reference in New Issue
Block a user