mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 18:56:22 +02:00
Guard against meaningless query and fragment parts.
This commit is contained in:
parent
1de3aaffc7
commit
f35c59ce5f
1 changed files with 6 additions and 3 deletions
|
@ -898,6 +898,9 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
|
||||||
return sensitivity;
|
return sensitivity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Guard against meaningless query and fragment parts.
|
||||||
|
// Do NOT use PreferLocalFile as its behavior is unpredictable (e.g., on defaultScriptsLocation())
|
||||||
|
const auto strippingFlags = QUrl::RemoveFilename | QUrl::RemoveQuery | QUrl::RemoveFragment;
|
||||||
for (QString file : includeFiles) {
|
for (QString file : includeFiles) {
|
||||||
QUrl thisURL { resolvePath(file) };
|
QUrl thisURL { resolvePath(file) };
|
||||||
if (!_includedURLs.contains(thisURL)) {
|
if (!_includedURLs.contains(thisURL)) {
|
||||||
|
@ -905,8 +908,8 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
|
||||||
(
|
(
|
||||||
(currentSandboxURL.scheme() != "file") ||
|
(currentSandboxURL.scheme() != "file") ||
|
||||||
(
|
(
|
||||||
!thisURL.toString(QUrl::RemoveFilename).startsWith(defaultScriptsLocation().toString(), getSensitivity()) &&
|
!thisURL.toString(strippingFlags).startsWith(defaultScriptsLocation().toString(), getSensitivity()) &&
|
||||||
!thisURL.toString(QUrl::RemoveFilename).startsWith(currentSandboxURL.toString(QUrl::RemoveFilename), getSensitivity())
|
!thisURL.toString(strippingFlags).startsWith(currentSandboxURL.toString(strippingFlags), getSensitivity())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue