Fix Youtube Previewing Crashing by adding shorts support#578
Merged
7w1 merged 3 commits intoSableClient:devfrom Mar 28, 2026
Merged
Fix Youtube Previewing Crashing by adding shorts support#5787w1 merged 3 commits intoSableClient:devfrom
7w1 merged 3 commits intoSableClient:devfrom
Conversation
Contributor
Author
|
i swear i am going mad w the browsers ~-~ |
7w1
approved these changes
Mar 28, 2026
Just-Insane
added a commit
to Just-Insane/Sable
that referenced
this pull request
Mar 29, 2026
… parser Non-video YouTube URLs (channels, @Handles, shorts-style paths without query params) caused `path.split('?')[1]` to return undefined, crashing with 'Cannot read properties of undefined (reading split)'. Changed to optional chaining with nullish coalescing fallback: `path.split('?')[1]?.split('&') ?? []` Part of the fix started in SableClient#578 (shorts support).
10 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 30, 2026
… parser (#584) ### 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: ```ts params = path.split('?')[1].split('&'); ``` When there is no `?` in the URL, `split('?')[1]` returns `undefined`, and calling `.split('&')` on it throws: > `TypeError: Cannot read properties of undefined (reading 'split')` Fixed with optional chaining + nullish fallback: ```ts params = path.split('?')[1]?.split('&') ?? []; ``` This causes `videoId` to remain `undefined` for non-video URLs, which is handled correctly by the existing `if (!videoId) return null` guard — the preview simply doesn't render rather than crashing the entire app. Fixes # #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings ### AI disclosure: - [x] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). AI identified the root cause after reviewing the PR #578 diff — the shorts fix added the `/shorts/` branch but left the original `youtube.com` branch with the same unguarded `.split()` call. The one-line fix (`?.split('&') ?? []`) was AI-suggested; I reviewed and confirmed it is correct.
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
Added basic shorts support and a fallback to fix it from crashing on shorts.
Fixes #
Type of change
Checklist:
AI disclosure:
Athena has cursed me with the wisdom to fix this.