summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-06-24 23:52:53 +0200
committerGitHub <noreply@github.com>2021-06-24 23:52:53 +0200
commitfdccc0b2195813d7874a7d9b97fff46081772e1e (patch)
treee2a956b14d9d1f8824d20a6f78d5a56585f0e885
parenta01ea509f5b2417cad1712f74642462fe85f5170 (diff)
parent91477cd4a9224b99b4c529e9268e533fe386696c (diff)
Merge pull request #49889 from timothyqiu/url-path
Strip query string when parsing HTTP request line for path
-rw-r--r--platform/javascript/export/export.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 58cecfef63..51c72e10eb 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -135,8 +135,11 @@ public:
// Wrong protocol
ERR_FAIL_COND_MSG(req[0] != "GET" || req[2] != "HTTP/1.1", "Invalid method or HTTP version.");
- const String req_file = req[1].get_file();
- const String req_ext = req[1].get_extension();
+ const int query_index = req[1].find_char('?');
+ const String path = (query_index == -1) ? req[1] : req[1].substr(0, query_index);
+
+ const String req_file = path.get_file();
+ const String req_ext = path.get_extension();
const String cache_path = EditorPaths::get_singleton()->get_cache_dir().plus_file("web");
const String filepath = cache_path.plus_file(req_file);