fix(url-preview): guard against undefined query string in YouTube URL parser#584
Merged
7w1 merged 1 commit intoSableClient:devfrom Mar 30, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
63e663f to
647509b
Compare
Member
|
looks like your pr accidentally reverts dae8e6a |
647509b to
4a110ea
Compare
7w1
approved these changes
Mar 30, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 30, 2026
> [!IMPORTANT] > Merging this PR will create a new release. ## Fixes * Add youtube shorts support to stop it from crashing sable. ([#578](#578) by @nushea) * Fix rich-text reply previews and custom-formatted messages so unsafe HTML is filtered more strictly and Matrix colors render correctly. ([#571](#571) by @hazre) * Fix crash when previewing non-video YouTube URLs (channels, @Handles, etc.) that lack query parameters. ([#584](#584) by @Just-Insane) * fix id handling and id generation for Personas ([#583](#583) by @dozro)
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.
Description
Fixes a crash when any non-video YouTube URL is previewed — channels (
youtube.com/@handle), channel IDs (youtube.com/channel/...), or any URL path without a?query string.The existing code (even after #578) had:
When there is no
?in the URL,split('?')[1]returnsundefined, and calling.split('&')on it throws:Fixed with optional chaining + nullish fallback:
This causes
videoIdto remainundefinedfor non-video URLs, which is handled correctly by the existingif (!videoId) return nullguard — the preview simply doesn't render rather than crashing the entire app.Fixes #
Type of change
Checklist:
AI disclosure:
AI identified the root cause after reviewing the PR #578 diff — the shorts fix added the
/shorts/branch but left the originalyoutube.combranch with the same unguarded.split()call. The one-line fix (?.split('&') ?? []) was AI-suggested; I reviewed and confirmed it is correct.