This repository has been archived on 2026-10-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Sable/src
7w1 f04fff486c Harden YouTube URL handling in embed feature (#599)
### 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

- [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
- [x] 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:

- [ ] 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).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->

No AI involved
2026-03-31 00:03:21 +00:00
..
2026-03-11 21:17:51 -05:00
2026-03-17 23:18:55 -05:00
2026-03-20 13:00:01 -07:00
2026-03-17 23:18:55 -05:00
2026-03-17 23:18:55 -05:00