refactor: if we have a Uint8Array and matching hash type, strip it
This commit is contained in:
parent
f85a2443d3
commit
8451974d6e
|
@ -75,8 +75,8 @@ export function encodeRegistryCid(
|
||||||
raw: boolean = false,
|
raw: boolean = false,
|
||||||
): ErrTuple<string | Uint8Array> {
|
): ErrTuple<string | Uint8Array> {
|
||||||
if (hash instanceof Uint8Array) {
|
if (hash instanceof Uint8Array) {
|
||||||
if (!Object.values(CID_HASH_TYPES).includes(hash[0])) {
|
if (Object.values(CID_HASH_TYPES).includes(hash[0])) {
|
||||||
return ["", "invalid hash type"];
|
hash = hash.slice(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue