forked from TrueCloudLab/frostfs-node
[#448] util/keyer: Prioritize hex decoding over base58
Hex encoded values are often may be misinterpreted as base58 values. Reverse case is quite rare, so it is better to try hex decoding first. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
3fe5962e92
commit
70dcb920b7
1 changed files with 2 additions and 2 deletions
|
@ -36,9 +36,9 @@ func (d *Dashboard) ParseString(data string) error {
|
|||
)
|
||||
|
||||
// data could be encoded in base58 or hex formats, try both
|
||||
rawData, err = base58.Decode(data)
|
||||
if err != nil {
|
||||
rawData, err = hex.DecodeString(data)
|
||||
if err != nil {
|
||||
rawData, err = base58.Decode(data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("data is not hex or base58 encoded: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue