Skip to content

Harden YouTube URL handling in embed feature#599

Merged
7w1 merged 1 commit intoSableClient:devfrom
dozro:fix/url-sanitation-for-url-embeds
Mar 31, 2026
Merged

Harden YouTube URL handling in embed feature#599
7w1 merged 1 commit intoSableClient:devfrom
dozro:fix/url-sanitation-for-url-embeds

Conversation

@dozro
Copy link
Copy Markdown
Contributor

@dozro dozro commented Mar 30, 2026

Description

This pull request refactors the parseYoutubeLink function in ClientPreview.tsx to use the standard URL API for parsing YouTube URLs. This change improves the reliability and maintainability of the code by handling edge cases and reducing manual string manipulation.

Improvements to YouTube URL parsing

  • Refactored parseYoutubeLink to use the URL API for robust parsing of YouTube URLs, improving error handling and supporting more YouTube link formats.
  • Enhanced extraction of video ID, playlist, and timestamp by using URL search parameters instead of manual string splitting, making the code more readable and less error-prone.

Fixes https://github.com/SableClient/Sable/security/code-scanning/9

Type of change

  • 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:

  • My code follows the style guidelines of this project
  • 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
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

No AI involved

@dozro dozro requested a review from 7w1 March 30, 2026 15:33
@dozro dozro requested a review from hazre as a code owner March 30, 2026 15:33
@dozro dozro added the internal label Mar 30, 2026
Copy link
Copy Markdown
Member

@7w1 7w1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@7w1 7w1 enabled auto-merge March 30, 2026 23:58
@7w1 7w1 disabled auto-merge March 31, 2026 00:03
@7w1 7w1 added this pull request to the merge queue Mar 31, 2026
Merged via the queue into SableClient:dev with commit f04fff4 Mar 31, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants