Skip to content

Commit

Permalink
Return None is string cannot be decoded
Browse files Browse the repository at this point in the history
  • Loading branch information
Grennith committed Jan 21, 2024
1 parent 7adf606 commit cce2be2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ async def from_json(json_data: Union[bytes, str]) -> Optional[LatestMitmDataEntr
if not raw_data:
return None
elif isinstance(raw_data, str):
data: Union[List, Dict, bytes] = base64.b64decode(raw_data)
try:
data: Union[List, Dict, bytes] = base64.b64decode(raw_data)
except Exception:
return None
else:
data: Union[List, Dict, bytes] = raw_data
obj: LatestMitmDataEntry = LatestMitmDataEntry(location,
Expand Down

0 comments on commit cce2be2

Please sign in to comment.