fix: tolerate non-UTF-8 bodies in ApifyRequestList remote sources#871
Merged
fix: tolerate non-UTF-8 bodies in ApifyRequestList remote sources#871
Conversation
A `requestsFromUrl` source returning bytes that aren't valid UTF-8 raised `UnicodeDecodeError` and aborted `ApifyRequestList.open`, crashing Actor startup. Decode with `errors='replace'`; the URL regex is ASCII-only so extraction is unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #871 +/- ##
==========================================
+ Coverage 86.64% 86.67% +0.03%
==========================================
Files 48 48
Lines 2920 2920
==========================================
+ Hits 2530 2531 +1
+ Misses 390 389 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Pijukatel
approved these changes
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ApifyRequestList._process_remote_urldecoded remoterequestsFromUrlresponse bodies withresponse_body.decode('utf-8')in strict mode. Any source returning non-UTF-8 bytes (latin-1, Windows-1252, binary, etc.) raisedUnicodeDecodeError, and because_fetch_requests_from_urlusesasyncio.gatherwithoutreturn_exceptions=True, the error propagated out ofApifyRequestList.openand crashed Actor startup — taking well-formed sibling sources down with it.errors='replace'.URL_NO_COMMAS_REGEXonly matches ASCII, so replacing invalid bytes with U+FFFD doesn't change which URLs are extracted; it just avoids the crash.0xE9and asserts the embedded URL is still extracted.🤖 Generated with Claude Code