Skip to content

Commit

Permalink
Sanitise subscription status (hypothesis edge case)
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain-S committed Jan 9, 2025
1 parent a373189 commit 52047ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rctab/routers/accounting/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ async def post_status(
await insert_subscriptions_if_not_exists(unique_subscriptions)

for new_status in all_status.status_list:
temp = new_status.model_dump_json().encode("utf-8")
if b"\\u0000" in temp:
logger.warning(
"Subscription Status contained unexpected unicode NULL codepoint: %s",
new_status,
)
new_status = SubscriptionStatus.model_validate_json(
temp.replace(b"\\u0000", b"NUL").decode("utf-8")
)

# We want the most recent status for this subscription.
status_select = (
subscription_details.select()
Expand Down

0 comments on commit 52047ab

Please sign in to comment.