Skip to content

Commit 7ee4293

Browse files
bugfix: Handling UnicodeDecodeError in unpack function (mobilityhouse#666)
Fixes mobilityhouse#6. Closes the following PRs for dependabot: - mobilityhouse#649 - mobilityhouse#639 - mobilityhouse#630 - mobilityhouse#625
1 parent fccde49 commit 7ee4293

File tree

4 files changed

+464
-321
lines changed

4 files changed

+464
-321
lines changed

ocpp/messages.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def unpack(msg):
8181
"""
8282
try:
8383
msg = json.loads(msg)
84-
except json.JSONDecodeError:
84+
except (json.JSONDecodeError, UnicodeDecodeError):
8585
raise FormatViolationError(
8686
details={"cause": "Message is not valid JSON", "ocpp_message": msg}
8787
)

0 commit comments

Comments
 (0)