mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Fix parsing of embedded entity scripts
Now correctly identifies when scripts are not urls as well as javascript: urls.
This commit is contained in:
parent
9962d47173
commit
f9b6db12e3
1 changed files with 8 additions and 1 deletions
|
@ -110,11 +110,18 @@ void ScriptCache::getScriptContents(const QString& scriptOrURL, contentAvailable
|
|||
QUrl url = ResourceManager::normalizeURL(unnormalizedURL);
|
||||
|
||||
// attempt to determine if this is a URL to a script, or if this is actually a script itself (which is valid in the entityScript use case)
|
||||
if (url.scheme().isEmpty() && scriptOrURL.simplified().replace(" ", "").contains("(function(){")) {
|
||||
if (unnormalizedURL.scheme().isEmpty() && scriptOrURL.simplified().replace(" ", "").contains("(function(){")) {
|
||||
contentAvailable(scriptOrURL, scriptOrURL, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// give a similar treatment to javacript: urls
|
||||
if (unnormalizedURL.scheme() == "javascript") {
|
||||
QString contents{ scriptOrURL };
|
||||
contents.replace(QRegExp("^javascript:"), "");
|
||||
contentAvailable(scriptOrURL, contents, false, true);
|
||||
}
|
||||
|
||||
Lock lock(_containerLock);
|
||||
if (_scriptCache.contains(url) && !forceDownload) {
|
||||
auto scriptContent = _scriptCache[url];
|
||||
|
|
Loading…
Reference in a new issue