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
83 QUrl defaultScriptsLoc = defaultScriptsLocation();83 QUrl defaultScriptsLoc = defaultScriptsLocation();
84 url.setPath(defaultScriptsLoc.path() + "/" + splitPath.mid(2).join("/")); // 2 to skip the slashes in /~/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 working86 // stop something like Script.include(["/~/../Desktop/naughty.js"]); from working
87 qDebug() << "url: " << url.path();
88 qDebug() << "BEFORE: " << url.path();
89 QFileInfo fileInfo(url.toLocalFile());87 QFileInfo fileInfo(url.toLocalFile());
90 url = QUrl::fromLocalFile(fileInfo.absoluteFilePath());88 url = QUrl::fromLocalFile(fileInfo.canonicalFilePath());
91 qDebug() << "AFTER: " << url.path();
92 qDebug() << "default: " << defaultScriptsLoc.path();
93
94 if (!defaultScriptsLoc.isParentOf(url)) {89 if (!defaultScriptsLoc.isParentOf(url)) {
95 qCWarning(scriptengine) << "Script.include() ignoring file path" << normalizedScriptURL90 qCWarning(scriptengine) << "Script.include() ignoring file path" << rawScriptURL
96 << "outside of standard libraries" << url.path() << defaultScriptsLoc.path();91 << "-- outside of standard libraries: " << url.path() << defaultScriptsLoc.path();
97 // return QUrl("");92 return QUrl("");
98 }93 }
99 return url;94 return url;
100 }95 }