Skip to content

Commit 4695f62

Browse files
author
Joan Fontanals Martinez
committed
fix: try fixing problem with blob encoding
1 parent 21520e4 commit 4695f62

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docarray/document/mixins/pydantic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def from_pydantic_model(cls: Type['T'], model: 'BaseModel') -> 'T':
7272
# second time is at `from_dict/from_json`, it is unnecessary yet inevitable, the result string get
7373
# converted into a binary string and encoded again.
7474
# consequently, we need to decode two times here!
75-
fields[f_name] = base64.b64decode(base64.b64decode(value))
75+
fields[f_name] = base64.b64decode(value)
7676
else:
7777
fields[f_name] = value
7878

docarray/document/pydantic_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class PydanticDocument(BaseModel):
5555
def _blob2base64(cls, v):
5656
if v is not None:
5757
if isinstance(v, bytes):
58-
return base64.b64encode(v).decode('utf8')
58+
return base64.b64encode(v)
5959
else:
6060
raise ValueError('must be bytes')
6161

0 commit comments

Comments
 (0)