@@ -23,9 +23,11 @@ import dialog from '../js/dialog.js';
2323
2424TABS . firmware_flasher = { } ;
2525
26- // Allow hyphens due to 9.0.0 patch
26+ // Normalize target names to underscores for consistent dictionary lookups.
27+ // Hyphens supported as workaround for 9.0.0 filename inconsistency.
2728function normalizeTargetName ( name ) {
28- return name . replace ( / - / g, '_' ) ;
29+ if ( name == null ) return '' ;
30+ return String ( name ) . replace ( / - / g, '_' ) ;
2931}
3032
3133TABS . firmware_flasher . initialize = function ( callback ) {
@@ -123,7 +125,7 @@ TABS.firmware_flasher.initialize = function (callback) {
123125 if ( selectedTarget === "0" ) {
124126 TABS . firmware_flasher . getTarget ( ) ;
125127 } else {
126- $ ( 'select[name="board"] option[value=' + selectedTarget + ']' ) . attr ( "selected" , "selected" ) ;
128+ $ ( 'select[name="board"] option[value=" ' + selectedTarget + '" ]' ) . attr ( "selected" , "selected" ) ;
127129 $ ( 'select[name="board"]' ) . trigger ( 'change' ) ;
128130 }
129131 } ) ;
@@ -230,7 +232,10 @@ TABS.firmware_flasher.initialize = function (callback) {
230232 "notes" : release . body ,
231233 "status" : release . prerelease ? "release-candidate" : "stable"
232234 } ;
233- releases [ result . target_id ] . push ( descriptor ) ;
235+ // Skip duplicate entries (e.g. both hyphen and underscore variants of same target+version)
236+ if ( ! releases [ result . target_id ] . some ( d => d . version === descriptor . version && d . status === descriptor . status ) ) {
237+ releases [ result . target_id ] . push ( descriptor ) ;
238+ }
234239 } ) ;
235240 } ) ;
236241
@@ -284,7 +289,10 @@ TABS.firmware_flasher.initialize = function (callback) {
284289 "notes" : release . body ,
285290 "status" : release . prerelease ? "nightly" : "stable"
286291 } ;
287- releases [ result . target_id ] . push ( descriptor ) ;
292+ // Skip duplicate entries (e.g. both hyphen and underscore variants of same target+version)
293+ if ( ! releases [ result . target_id ] . some ( d => d . version === descriptor . version && d . status === descriptor . status ) ) {
294+ releases [ result . target_id ] . push ( descriptor ) ;
295+ }
288296 } ) ;
289297 } ) ;
290298 }
@@ -334,6 +342,7 @@ TABS.firmware_flasher.initialize = function (callback) {
334342
335343 $ ( "a.load_remote_file" ) . addClass ( 'disabled' ) ;
336344 var target = $ ( this ) . children ( "option:selected" ) . val ( ) ;
345+ var targetDisplay = $ ( this ) . children ( "option:selected" ) . text ( ) ;
337346
338347 if ( ! GUI . connect_lock ) {
339348 $ ( '.progress' ) . val ( 0 ) . removeClass ( 'valid invalid' ) ;
@@ -346,7 +355,7 @@ TABS.firmware_flasher.initialize = function (callback) {
346355 if ( target == 0 ) {
347356 versions_e . append ( $ ( "<option value='0'>{0}</option>" . format ( i18n . getMessage ( 'firmwareFlasherOptionLabelSelectFirmwareVersion' ) ) ) ) ;
348357 } else {
349- versions_e . append ( $ ( "<option value='0'>{0} {1}</option>" . format ( i18n . getMessage ( 'firmwareFlasherOptionLabelSelectFirmwareVersionFor' ) , target ) ) ) ;
358+ versions_e . append ( $ ( "<option value='0'>{0} {1}</option>" . format ( i18n . getMessage ( 'firmwareFlasherOptionLabelSelectFirmwareVersionFor' ) , targetDisplay ) ) ) ;
350359 }
351360
352361 if ( typeof TABS . firmware_flasher . releases [ target ] ?. forEach === 'function' ) {
0 commit comments