mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
make base64 decoding cross-platform
support both the -D and the -d flag. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
@ -109,3 +109,13 @@ test_seq() {
|
||||
i=$(expr "$i" + 1)
|
||||
done
|
||||
}
|
||||
|
||||
b64decode() {
|
||||
for flag in "-D" "-d"; do
|
||||
if base64 "$flag" 2>/dev/null; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo "no compatible base64 command found" >&2
|
||||
return 1
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ test_expect_success 'findpeer' '
|
||||
|
||||
# ipfs dht put <key> <value>
|
||||
test_expect_success 'put with good keys' '
|
||||
echo "$TEST_DHT_VALUE" | base64 -d | ipfsi 0 dht put "$TEST_DHT_PATH" | sort >putted &&
|
||||
echo "$TEST_DHT_VALUE" | b64decode | ipfsi 0 dht put "$TEST_DHT_PATH" | sort >putted &&
|
||||
[ -s putted ] ||
|
||||
test_fsh cat putted
|
||||
'
|
||||
|
Reference in New Issue
Block a user