Skip to content

Commit

Permalink
Fix internal assertion encountered when testing with jsdom.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDuckworth committed Apr 8, 2024
1 parent b64b947 commit 2f58b4f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/firestore/src/remote/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export function toBytes(
*/
export function fromBytes(
serializer: JsonProtoSerializer,
value: string | Uint8Array | undefined
value: string | Uint8Array | Buffer | undefined
): ByteString {
if (serializer.useProto3Json) {
hardAssert(
Expand All @@ -262,8 +262,10 @@ export function fromBytes(
return ByteString.fromBase64String(value ? value : '');
} else {
hardAssert(
value === undefined || value instanceof Uint8Array,
'value must be undefined or Uint8Array'
value === undefined ||
value instanceof Buffer ||
value instanceof Uint8Array,
'value must be undefined, Buffer, or Uint8Array'
);
return ByteString.fromUint8Array(value ? value : new Uint8Array());
}
Expand Down

0 comments on commit 2f58b4f

Please sign in to comment.