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

fix v4: device name length limit OK-23899 OK-25152 #4544

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions packages/kit/src/utils/hardware/deviceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ class DeviceUtils {
if (msg.indexOf('Failure_UnexpectedMessage') !== -1) {
return new Error.UnknownMethod(payload);
}
if (msg.indexOf('string overflow') !== -1) {
return new Error.NameExceedingMaximumLimit(payload);
}
return new Error.UnknownHardwareError(payload);
case HardwareErrorCode.PinInvalid:
return new Error.InvalidPIN(payload);
Expand Down
6 changes: 6 additions & 0 deletions packages/kit/src/utils/hardware/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export class UnknownMethod extends OneKeyHardwareError {
override key: LocaleIds = 'msg__hardware_unknown_message_error';
}

export class NameExceedingMaximumLimit extends OneKeyHardwareError {
override code = HardwareErrorCode.RuntimeError;

override key: LocaleIds = 'msg__exceeding_the_maximum_word_limit';
}

export class ConnectTimeout extends OneKeyHardwareError {
override key: LocaleIds = 'msg__hardware_connect_timeout_error';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const OnekeyHardwareDeviceName: FC<DeviceNameProps> = ({
control={control}
rules={{
maxLength: {
value: 16,
value: 32,
message: intl.formatMessage({
id: 'msg__exceeding_the_maximum_word_limit',
}),
Expand Down
Loading