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