fix(notes): handle nullish and non-iterable placeholders in isRegenerableNoteTitle - #1816
fix(notes): handle nullish and non-iterable placeholders in isRegenerableNoteTitle#1816hsusul wants to merge 1 commit into
Conversation
|
Thanks @hsusul! Closing together with #1815. This helper has a single caller ( The tests themselves were well done and I ran them green — this is purely a scope-of-validation call, not a quality one. Thanks for the contribution, and keep 'em coming! |
Fixes #1815
Problem
In
src/helpers/regenerableNoteTitle.js:isRegenerableNoteTitledefaultedplaceholders = [], which only triggers whenplaceholders === undefined. If passednullor a non-iterable value, iterating withfor (const p of placeholders)threwTypeError: placeholders is not iterable.Solution
[]ifplaceholdersisnullor not iterable before iterating.test/helpers/regenerableNoteTitle.test.js.Verification
node --test test/helpers/regenerableNoteTitle.test.js(passes, 6/6 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)