From c50fde8a320c9bde3891a2f3c4e8b071f76016f9 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Thu, 12 Nov 2026 15:57:46 -0600 Subject: [PATCH] Fix a couple of potential issues with `query` calls that don't happen. First there is a typo and the `querylu` method is called instead of the `query` method in the `WeBWorK::ContentGenerator::pathMacro` method. Since that method doesn't exist, if that were ever called it would result in an exception. Fortunately, that is not actually every called! Also if the `%auth` and `%tail` hashes passed to the `query` call in the `WeBWorK::ContentGenerator::navMacro` method were empty then that `query` call would return a `Mojo::Parameters` object instead of the `Mojo::URL` object with query parameters added. Since that ends up being stringified and is an empty `Mojo::Parameters` object it is stringified as the empty string, which would make the returned URL be the root URL for the site instead of the desired URL. This does not happen at this point since the `effectiveUser` is always added, but if the `effectiveUser` were not always added, then this would break things. Passing a hash reference guarantees a proper `Mojo::URL` object is returned which will stringify to the correct URL. --- lib/WeBWorK/ContentGenerator.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator.pm b/lib/WeBWorK/ContentGenerator.pm index cbc57c5ccd..70613c3b85 100644 --- a/lib/WeBWorK/ContentGenerator.pm +++ b/lib/WeBWorK/ContentGenerator.pm @@ -787,7 +787,7 @@ sub pathMacro ($c, $args, @path) { if ($args{style} eq 'bootstrap') { push @$result, $c->tag('li', class => 'breadcrumb-item', $c->link_to($name => $url->query(\%auth))); } else { - push @$result, $c->link_to($name => $url->querylu(%auth)); + push @$result, $c->link_to($name => $url->query(\%auth)); } } else { if ($args{style} eq 'bootstrap') { @@ -831,7 +831,7 @@ sub navMacro ($c, $args, $tail, @links) { my $html = ($direction && $args{style} eq "buttons") ? $direction : $name; push @$result, $url - ? $c->link_to($html => $url->query(%auth, %$tail), class => 'btn btn-primary') + ? $c->link_to($html => $url->query({ %auth, %$tail }), class => 'btn btn-primary') : $c->tag('span', class => 'btn btn-primary disabled', $html); }