-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When sorting a slice of strings (ascending), the literal "infinity" string always comes last #10389
Comments
Confirmed.
This isn't new behavior. Same results with v0.54.0. |
acclassic
added a commit
to acclassic/hugo
that referenced
this issue
Jan 2, 2023
When sorting strings a worng order is returned. This happens because the strings are first converted to floating values to check whether or not they should be sorted as floating values. When an error is returned the strings will be handled as string literals. No error will be returned when parsing Inf, Infinity or NaN (case insensitive) because they will be coverted to special floating point values and therefore are legal float values. Now we check if the returned converted values are special floating values and treat them as string literals. Fixes gohugoio#10389
bep
pushed a commit
that referenced
this issue
Jan 2, 2023
When sorting strings a worng order is returned. This happens because the strings are first converted to floating values to check whether or not they should be sorted as floating values. When an error is returned the strings will be handled as string literals. No error will be returned when parsing Inf, Infinity or NaN (case insensitive) because they will be coverted to special floating point values and therefore are legal float values. Now we check if the returned converted values are special floating values and treat them as string literals. Fixes #10389
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
Description of the Issue
Given a slice of strings, Hugo treats "infinity" as alphabetically last in the list. E.g.:
Produces:
It seems like
infinity
is being treated as a numeric value despite being defined as a string among other strings.The text was updated successfully, but these errors were encountered: