Skip to content

Fix float parsing of ISO section codes like 5.10#799

Open
VivekGhantiwala wants to merge 1 commit intoOWASP:mainfrom
VivekGhantiwala:fix/iso-section-float-parsing
Open

Fix float parsing of ISO section codes like 5.10#799
VivekGhantiwala wants to merge 1 commit intoOWASP:mainfrom
VivekGhantiwala:fix/iso-section-float-parsing

Conversation

@VivekGhantiwala
Copy link

What

Replace get_all_records() with get_all_values() in read_spreadsheet() to prevent gspread's numericise() from
converting ISO section codes like "5.10" to float 5.1.

Why

get_all_records() internally calls numericise() which strips trailing zeros from decimal-looking strings. The
existing numericise_ignore workaround misses column 0 and depends on gspread internals that have known bugs (see gspread#1007).
get_all_values() always returns raw cell strings, so "5.10" stays "5.10". We manually construct the row dicts using
the header row.

Testing

Existing test test_read_spreadsheet_iso_numbers validates that section IDs "1.10" and "10.10" are preserved as
strings.

Closes #574
Closes #546

Replace get_all_records() with get_all_values() to bypass gspread's
numericise() which converts section codes like '5.10' to float 5.1.
get_all_values() returns raw strings, preserving trailing zeros.

Fixes OWASP#574
Fixes OWASP#546
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.

Regression of ISO 5.10 issue ISO control numbers interpreted wrongfully

1 participant