Skip to content

fix(flasher): render failedToFlash progress message as HTML, not text - #2678

Merged
sensei-hacker merged 1 commit into
iNavFlight:maintenance-9.xfrom
daijoubu:fix-flash-progress-html-escaping
Jul 10, 2026
Merged

fix(flasher): render failedToFlash progress message as HTML, not text#2678
sensei-hacker merged 1 commit into
iNavFlight:maintenance-9.xfrom
daijoubu:fix-flash-progress-html-escaping

Conversation

@daijoubu

Copy link
Copy Markdown
Contributor

Summary

Fixes the firmware-flasher progress bar showing the literal markup <span style="color: red">Failed</span> to flash COM3 as plain text instead of styled red text, when a DFU/bootloader detection timeout occurs during flashing.

Root Cause

The failedToFlash i18n string (locale/en/messages.json) intentionally embeds an HTML <span style="color: red"> tag, matching the pattern used for several other i18n strings displayed in this UI. GUI.log(...) renders it correctly because it inserts content via .append(), which parses HTML. The very next line, however, updated span.progressLabel with jQuery's .text(), which escapes markup instead of interpreting it — so users saw the raw tag text.

Checked every other call site that writes to span.progressLabel: all other i18n keys used there are plain text with no markup, and firmwareFlasherTab.flashingMessage() (the primary path for updating this element) already uses .html(). This was the one inconsistent call site.

Changes

  • js/protocols/stm32.js: changed $('span.progressLabel').text(...) to .html(...) in the DFU/bootloader timeout handler, matching the existing .html() pattern used elsewhere for this element.
  • Added tests/firmware-flasher-progress-html.test.mjs: a regression test that source-inspects the onTimeout callback and asserts it uses .html() (not .text()) when writing the failedToFlash message, consistent with this repo's existing tests/firmware-flasher.test.mjs conventions.

Testing

  • Added a regression test that fails against the pre-fix code (confirmed) and passes after the fix.
  • Ran full test suite: npm test — 45/45 passing.
  • Reviewed with the inav-code-review agent — no critical/important issues; one minor test-structure suggestion applied (dropped a non-exercising DOM simulation, kept the effective source-inspection assertion).
  • Not hardware-tested: reproducing the actual DFU timeout requires a real flash timeout condition on hardware. The fix is a one-line rendering change (.text().html()) matching an existing, proven pattern already used elsewhere for the same UI element, so this is low risk, but flagging that live-hardware confirmation wasn't performed.

Other progress bar states checked

Confirmed no other progress bar messages (success, in-progress, cancelled) have the same text/HTML mismatch.

The failedToFlash i18n string embeds a <span style="color: red"> tag so
"Failed" renders in red, matching the flashingMessage() styling used
elsewhere for span.progressLabel. The DFU timeout path instead inserted
it with jQuery .text(), so users see the literal markup in the progress
bar instead of styled text.
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Configurator test build ready — commit 7d54f1c

Download build artifacts for PR #2678

Available platforms (scroll to the Artifacts section at the bottom of the run page):

  • Windows x64 (ZIP, MSI) and x32 (ZIP, MSI)
  • macOS arm64 (ZIP, DMG) and x64 (ZIP, DMG)
  • Linux x64 (DEB, RPM, ZIP) and aarch64 (DEB, RPM, ZIP)

A GitHub login is required to download artifacts. Build is for testing only.

@sensei-hacker
sensei-hacker merged commit af70e7e into iNavFlight:maintenance-9.x Jul 10, 2026
8 checks passed
This was referenced Jul 12, 2026
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.

2 participants