mirror of https://github.com/jetkvm/kvm.git
fix: Remove 0x prefix for HEX
This commit is contained in:
parent
cd78bb5ada
commit
41e2bd7323
|
@ -61,8 +61,9 @@ func remoteKvmSwitchChannelRawIP(channel *SwitchChannel, idx int, command *Switc
|
|||
case SwitchChannelCommandFormatHEX:
|
||||
// Split by comma and parse as HEX
|
||||
for _, cmd := range strings.Split(command.Commands, ",") {
|
||||
// Parse HEX
|
||||
b, err := hex.DecodeString(strings.TrimSpace(cmd))
|
||||
// Trim spaces, remove 0x prefix and parse as HEX
|
||||
commandText := strings.ToLower(strings.TrimPrefix(strings.TrimSpace(cmd), "0x"))
|
||||
b, err := hex.DecodeString(commandText)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid command provided for command #%d: %w", idx, err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue