Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(connect): fw-update: add error message when binary is too small #12472

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions packages/connect/src/core/onCallFirmwareUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,27 @@ const getBinaryHelper = (
version: device.firmwareRelease.release.version,
btcOnly,
intermediaryVersion,
}).then(res => {
postMessage(
createUiMessage(UI.FIRMWARE_PROGRESS, {
device: device.toMessageObject(),
operation: 'downloading',
progress: 100,
}),
);
})
.then(res => {
// suspiciously small binary. this typically happens when build does not have git lfs enabled and all
// you download here are some pointers to lfs objects which are around ~132 byteLength
if (res.byteLength < 200) {
throw ERRORS.TypedError('Runtime', 'Firmware binary is too small');
}

return res;
});
return res;
})
.then(res => {
postMessage(
createUiMessage(UI.FIRMWARE_PROGRESS, {
device: device.toMessageObject(),
operation: 'downloading',
progress: 100,
}),
);

return res;
});
};

const firmwareCheck = async (
Expand Down
Loading