History

fix problem where canonicalFilePath will strip a trailing slash

Seth Alves committed 10 years ago

Commit b28cfd21 parent 36e84e63 files · +11 −10Browse files

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

Unified · Split

libraries/script-engine/src/ScriptEngines.cpp+3−6
@@ -89,13 +89,7 @@ QUrl expandScriptUrl(const QUrl& rawScriptURL) { · 88 unmodified lines
8989
9090 // stop something like Script.include(["/~/../Desktop/naughty.js"]); from working
9191 QFileInfo fileInfo(url.toLocalFile());
92− #if defined(Q_OS_WIN)
93− url = QUrl::fromLocalFile(fileInfo.canonicalFilePath().toLower());
94− #elif defined(Q_OS_OSX)
95− url = QUrl::fromLocalFile(fileInfo.canonicalFilePath().toLower());
96− #else
9792 url = QUrl::fromLocalFile(fileInfo.canonicalFilePath());
98− #endif
9993
10094 QUrl defaultScriptsLoc = defaultScriptsLocation();
10195 if (!defaultScriptsLoc.isParentOf(url)) {
@@ -105,6 +99,9 @@ QUrl expandScriptUrl(const QUrl& rawScriptURL) { · 3 unmodified lines
10599 << defaultScriptsLoc.path();
106100 return rawScriptURL;
107101 }
102+ if (rawScriptURL.path().endsWith("/") && !url.path().endsWith("/")) {
103+ url.setPath(url.path() + "/");
104+ }
108105 return url;
109106 }
110107 return normalizedScriptURL;