Skip to content

Commit

Permalink
Merge pull request #49889 from timothyqiu/url-path
Browse files Browse the repository at this point in the history
Strip query string when parsing HTTP request line for path
  • Loading branch information
Faless authored Jun 24, 2021
2 parents a01ea50 + 91477cd commit fdccc0b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions platform/javascript/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ class EditorHTTPServer : public RefCounted {
// 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);

Expand Down

0 comments on commit fdccc0b

Please sign in to comment.