Skip to content

Commit

Permalink
Accept truncated subgraph IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed May 18, 2022
1 parent ad447d5 commit ca60e4c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/prelude/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ impl FromStr for SubgraphID {
// Attempt to decode v2 format: base58 of sha256 hash
let mut hash = [0u8; 32];
let len = bs58::decode(s).into(&mut hash).ok()?;
if len != hash.len() {
if len > hash.len() {
return None;
}
hash.rotate_right(32 - len);
Some(hash)
}
if let Some(v2) = parse_v2(s) {
Expand Down

0 comments on commit ca60e4c

Please sign in to comment.