#35172 closed Bug (fixed)
intcomma adds leading comma for string-based 3-digit number with at least 1 decimal place.
Reported by: | Warwick Brown | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | contrib.humanize | Version: | 3.2 |
Severity: | Release blocker | Keywords: | humanize intcomma comma decimal places |
Cc: | Natalia Bidart, Adam Johnson | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm running (4, 2, 10, 'final', 0)
Just discovered that the patch to intcomma made in CVE-2024-24680 is causing numbers to appear with a leading comma when they're 3 digits (ie between 100 and 999) with at least 1 decimal place
In [34]: intcomma('111') Out[34]: '111' In [35]: intcomma('111.1') Out[35]: ',111.1' In [36]: intcomma('99.1') Out[36]: '99.1' In [37]: intcomma('999.1') Out[37]: ',999.1'
I note there doesn't appear to be a test in tests/humanize_tests/tests.py
for the case of a string "111.1"
I encountered this because I use {{ price|floatformat:2|intcomma }}
in templates, thus floatformat is providing a string to intcomma.
Change History (10)
comment:1 by , 10 months ago
Type: | Uncategorized → Bug |
---|
comment:2 by , 10 months ago
Cc: | added |
---|---|
Severity: | Normal → Release blocker |
Summary: | intcomma patch in CVE-2024-24680 causing leading comma when provided string-based 3-digit number with at least 1 decimal place → intcomma adds leading comma for string-based 3-digit number with at least 1 decimal place. |
Triage Stage: | Unreviewed → Accepted |
Version: | 4.2 → 3.2 |
comment:3 by , 10 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 10 months ago
Needs documentation: | unset |
---|
Note:
See TracTickets
for help on using tickets.
Great catch! Thanks for the report.
Regression in 55519d6cf8998fe4c8f5c8abffc2b10a7c3d14e9.