From d493e00a674a9d3a0f90bd2edd38803f74b36928 Mon Sep 17 00:00:00 2001 From: Salakar Date: Thu, 3 May 2018 21:50:53 +0100 Subject: [PATCH] [firestore][js] additional Blob class input arg validations --- lib/modules/firestore/Blob.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/modules/firestore/Blob.js b/lib/modules/firestore/Blob.js index 3d8149e9..6f4f5bb9 100644 --- a/lib/modules/firestore/Blob.js +++ b/lib/modules/firestore/Blob.js @@ -14,6 +14,12 @@ export default class Blob { * @param base64 string */ static fromBase64String(base64: string): Blob { + if (typeof base64 !== 'string' || base64.length < 1) { + throw new Error( + 'firestore.Blob.fromBase64String expects a string of at least 1 character in length' + ); + } + return new Blob(Base64.atob(base64)); }