Skip to content

Commit a577a97

Browse files
committed
frontend/summary,account: sdcard check false positive
If one inserts a BitBox02 while in the account summary or account, `useSDCard(devices);` returns true even if there is no sdcard, because: 1. It is called before the BitBox02 has established the communication (paired channel) 2. The checkSDCard endpoints returns an error 3. The `useSDCard()` assumes the result is `boolean` always, so it interprets the non-zero error as `true`, which leads to the warning banner being shown even if the sdcard is not inserted. This is a quick fix to not show the banner in this case by returning `false` instead of an error. The proper fix is postponed, and involes rewriting `useSDCard` to listen on the `statusChanged` event of the BitBox02 to only chekc the sdcard once the device is paired (or do something similar in the backend and make an `sdcard` event).
1 parent 8939a51 commit a577a97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

backend/devices/bitbox02/handlers/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (handlers *Handlers) getCheckSDCard(_ *http.Request) interface{} {
261261
handlers.log.Debug("Checking if SD Card is inserted")
262262
sdCardInserted, err := handlers.device.CheckSDCard()
263263
if err != nil {
264-
return maybeBB02Err(err, handlers.log)
264+
return false
265265
}
266266
return sdCardInserted
267267
}

0 commit comments

Comments
 (0)