Skip to content

Fix a couple of potential issues with query calls that don't happen. - #3281

Open
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:bugfix/bad-query-calls
Open

drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:bugfix/bad-query-calls

Conversation

@drgrice1

Copy link
Copy Markdown
Member

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.

Just some things noticed working on other things.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant