Actually use the videoID regex

This commit is contained in:
Adam Novak 2022-10-30 13:23:03 -04:00
parent bfc215e492
commit 29d1d12dab

View file

@ -77,8 +77,9 @@ pub async fn skip_segments_by_id(
db: Db, db: Db,
) -> content::RawJson<String> { ) -> content::RawJson<String> {
if videoID.is_empty() { // Check if ID matches ID regex
return content::RawJson("videoID is missing".to_string()); if !ID_RE.is_match(&videoID) {
return content::RawJson("videoID does not match format requirements".to_string());
} }
let sponsors = find_skip_segments(VideoName::ByID(videoID.clone()), categories, db).await; let sponsors = find_skip_segments(VideoName::ByID(videoID.clone()), categories, db).await;