fix(speaker-count): validate primitive type in normalizeStoredSpeakerCount - #1834
fix(speaker-count): validate primitive type in normalizeStoredSpeakerCount#1834hsusul wants to merge 1 commit into
Conversation
|
Thanks @hsusul — nice clean diff and the tests are in exactly our house style. Closing this one together with #1833 after tracing where the stored value can actually come from: the cloud path is validated server-side with One thing worth knowing for the future: this helper has an intentional twin — Really appreciate you digging into this area — thank you! |
Fixes #1833
Problem
In
src/helpers/speakerCount.js:normalizeStoredSpeakerCountconverted inputs directly withNumber(value), causing booleantrueto evaluate to1and array["2"]to evaluate to2instead of rejecting non-numeric types asnull.Solution
normalizeStoredSpeakerCountto only numbers and strings (typeof value === "number" || typeof value === "string") before numeric conversion.test/helpers/speakerCount.test.js.Verification
node --test test/helpers/speakerCount.test.js(passes, 3/3 tests)npm run typecheck(passes, 0 errors)npm run lint(passes, 0 errors)npm run i18n:check(passes)npm run build:renderer(passes)git diff --check(clean)