Skip to content

fix(dictation): guard settings and normalize cloudTranscriptionMode in needsSttConfigBeforeStart - #1928

Open
hsusul wants to merge 1 commit into
OpenWhispr:mainfrom
hsusul:fix/1927-stt-config-policy-normalization
Open

fix(dictation): guard settings and normalize cloudTranscriptionMode in needsSttConfigBeforeStart#1928
hsusul wants to merge 1 commit into
OpenWhispr:mainfrom
hsusul:fix/1927-stt-config-policy-normalization

Conversation

@hsusul

@hsusul hsusul commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1927

Problem

In src/helpers/sttConfigPolicy.js:

  • needsSttConfigBeforeStart(settings) used settings || {}, which did not safely guard against non-object primitives.
  • s.cloudTranscriptionMode !== "openwhispr" did strict case/whitespace comparisons, causing mixed-casing or whitespace-padded provider strings (e.g., "OpenWhispr" or " openwhispr ") to bypass the config wait and proceed without streaming configuration.

Solution

  • Added a proper object check for settings.
  • Normalized cloudTranscriptionMode with .trim().toLowerCase().
  • Added unit tests in test/helpers/sttConfigPolicy.test.js.

Verification

  • node --test test/helpers/sttConfigPolicy.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)

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.

needsSttConfigBeforeStart throws TypeError on null settings and fails on mixed-case cloudTranscriptionMode

1 participant