summaryrefslogtreecommitdiff
path: root/src/v1.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/v1.erl')
-rw-r--r--src/v1.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/v1.erl b/src/v1.erl
index d89b521..3c5e6b4 100644
--- a/src/v1.erl
+++ b/src/v1.erl
@@ -151,6 +151,12 @@ add_blob(Input) ->
{error, E} ->
err400("add-blob: bad input:", E);
{struct, [{<<"blob">>, Blob}]} ->
- success(catlfish:add_chain(Blob, normal));
- _ -> err400("add-blob: missing input: blob", Input)
+ case (catch base64:decode(Blob)) of
+ {'EXIT', _} ->
+ err400("add-blob: invalid base64-encoded blob", Blob);
+ DecodedBlob ->
+ success(catlfish:add_chain(DecodedBlob, [], normal))
+ end;
+ _ ->
+ err400("add-blob: missing input: blob", Input)
end.