Commit d0998a92 authored by Steven Allen's avatar Steven Allen

make base64 decoding cross-platform

support both the -D and the -d flag.

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent 118ecb22
...@@ -109,3 +109,13 @@ test_seq() { ...@@ -109,3 +109,13 @@ test_seq() {
i=$(expr "$i" + 1) i=$(expr "$i" + 1)
done 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' ' ...@@ -29,7 +29,7 @@ test_expect_success 'findpeer' '
# ipfs dht put <key> <value> # ipfs dht put <key> <value>
test_expect_success 'put with good keys' ' 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 ] || [ -s putted ] ||
test_fsh cat putted test_fsh cat putted
' '
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment