Skip to content

Commit

Permalink
fix a bug in query handling where ? was part of the path
Browse files Browse the repository at this point in the history
  • Loading branch information
meseta committed Dec 23, 2023
1 parent 3197409 commit 72ad55e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ HTGM can be used to host websites if built and deployed to a server, or it can b
HTGM was created by Meseta, released under the MIT open source license, and is free to use for commercial and non-commercial projects. The project is released as-is, and no support or warranties are provided, but those working on GameMaker projects in general may find help from the friendly GameMaker community on Discord.

## Change History
* v1.1.1 Fix query param handling
* v1.1.0 Add redirect functionality to HttpServerRenderBase
* v1.0.0 Initial release
7 changes: 3 additions & 4 deletions htgm/scripts/HttpServerRouter/HttpServerRouter.gml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function HttpServerRouter(_logger) constructor {
var _path_string;
if (_query_pos > 0) {
_path_params_string = string_copy(_raw_path, _query_pos+1, string_length(_raw_path)-_query_pos);
_path_string = string_copy(_raw_path, 1, _query_pos);
_path_string = string_copy(_raw_path, 1, _query_pos-1);
}
else {
_path_params_string = "";
Expand Down Expand Up @@ -216,14 +216,13 @@ function HttpServerRouter(_logger) constructor {
// decode path params
if (_path_params_string != "") {
var _path_params = string_split(_path_params_string, "&", true);
var _path_params_len = array_length(_path_params);

array_foreach(_path_params, method(_param_struct, function(_path_param, _idx) {
array_foreach(_path_params, method(_param_struct, function(_path_param) {
var _path_params_pair = string_split(_path_param, "=", false, 1);
var _key = _path_params_pair[0];

if (string_length(_key) > 0) {
var _value = _path_params_pair[1];
var _value = array_length(_path_params_pair) > 1 ? _path_params_pair[1] : undefined;

if (struct_exists(self, _key)) {
if (not is_array(self[$ _key])) {
Expand Down
1 change: 1 addition & 0 deletions htgm/scripts/init/init.gml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ else {
// don't ask to send sentry errors
SENTRY.set_option("ask_to_send", false);
SENTRY.set_option("ask_to_send_report", false);
SENTRY.set_option("show_popup", false);

// Use Sentry's error handler
exception_unhandled_handler(global.sentry.get_exception_handler());
Expand Down

0 comments on commit 72ad55e

Please sign in to comment.