Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 1 file). Show all
Unified · Split
| @@ -83,18 +83,13 @@ QUrl expandScriptUrl(const QUrl& rawScriptURL) { · 82 unmodified lines | ||
| 83 | 83 | QUrl defaultScriptsLoc = defaultScriptsLocation(); |
| 84 | 84 | url.setPath(defaultScriptsLoc.path() + "/" + splitPath.mid(2).join("/")); // 2 to skip the slashes in /~/ |
| 85 | 85 | |
| 86 | − // stop something like Script.include(["/~/../Users/james/Desktop/naughty.js"]); from working | |
| 87 | − qDebug() << "url: " << url.path(); | |
| 88 | − qDebug() << "BEFORE: " << url.path(); | |
| 86 | + // stop something like Script.include(["/~/../Desktop/naughty.js"]); from working | |
| 89 | 87 | QFileInfo fileInfo(url.toLocalFile()); |
| 90 | − url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); | |
| 91 | − qDebug() << "AFTER: " << url.path(); | |
| 92 | − qDebug() << "default: " << defaultScriptsLoc.path(); | |
| 93 | − | |
| 88 | + url = QUrl::fromLocalFile(fileInfo.canonicalFilePath()); | |
| 94 | 89 | if (!defaultScriptsLoc.isParentOf(url)) { |
| 95 | − qCWarning(scriptengine) << "Script.include() ignoring file path" << normalizedScriptURL | |
| 96 | − << "outside of standard libraries" << url.path() << defaultScriptsLoc.path(); | |
| 97 | − // return QUrl(""); | |
| 90 | + qCWarning(scriptengine) << "Script.include() ignoring file path" << rawScriptURL | |
| 91 | + << "-- outside of standard libraries: " << url.path() << defaultScriptsLoc.path(); | |
| 92 | + return QUrl(""); | |
| 98 | 93 | } |
| 99 | 94 | return url; |
| 100 | 95 | } |