History

trying some more to get /~/ to work right

Seth Alves committed 10 years ago

Commit ced18fe1 parent 8c2b89b1 file · +5 −10Browse files

Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngines.cpp+5−10
@@ -83,18 +83,13 @@ QUrl expandScriptUrl(const QUrl& rawScriptURL) { · 82 unmodified lines
8383 QUrl defaultScriptsLoc = defaultScriptsLocation();
8484 url.setPath(defaultScriptsLoc.path() + "/" + splitPath.mid(2).join("/")); // 2 to skip the slashes in /~/
8585
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
8987 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());
9489 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("");
9893 }
9994 return url;
10095 }