-
Notifications
You must be signed in to change notification settings - Fork 859
fix(bilibili): filter null subtitle content to prevent literal 'null' strings in video summaries #964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
PeterDaveHello
merged 1 commit into
ChatGPTBox-dev:master
from
octo-patch:fix/issue-893-bilibili-null-subtitle-content
May 10, 2026
Merged
fix(bilibili): filter null subtitle content to prevent literal 'null' strings in video summaries #964
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation assumes that
subtitlesis always an array and that each elementsis a valid object. If the API returns an unexpected response (e.g.,subtitleData.bodyis missing or containsnullentries), this code will throw aTypeError. Adding a fallback forsubtitlesand using optional chaining fors.contentwould make this more robust.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PeterDaveHello, the Gemini suggestion has some merit, but I'd call it partially worthwhile rather than essential. Here's my breakdown:(subtitles || [])— Reasonable defensive guard. IfsubtitleData.bodyisnullorundefined(malformed API response), calling.map()on it would throw aTypeError. That said, the entireinputQueryis already wrapped in atry/catch, so the error would be silently swallowed anyway. Adding|| []makes the failure mode slightly more graceful (returns''instead of throwing), which is a minor improvement.s?.content— This is the weaker part of the suggestion. The original issue (#893) was specifically that thecontentfield within a subtitle entry can benull— not that the subtitle entries themselves can benull. The Bilibili API is unlikely to returnnullelements inside thebodyarray. Optional chaining here is defensive against a case that isn't observed in practice. It's harmless sinceundefinedis already filtered out by.filter((c) => c != null), but it's essentially noise.My take: The PR as-is already addresses the reported bug cleanly. If you want to adopt part of the suggestion,
subtitles || []is a reasonable addition. I'd skips?.contentas it addresses an untested and unlikely edge case, adding minor cognitive overhead without a clear corresponding bug report.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, let’s keep this PR focused on content: null; malformed body handling is pre-existing and can be addressed separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PeterDaveHello, that makes sense — the PR is nicely scoped as-is. Would you like me to open a follow-up GitHub issue to track the pre-existing malformedbodyhandling (e.g., guarding againstnull/undefinedsubtitleData.body)? That way it won't get lost.