Skip to content

Commit

Permalink
Allow links to YouTube Shorts in YouTube Embed
Browse files Browse the repository at this point in the history
Support YouTube shorts. The embed markup works without changes.
  • Loading branch information
MSchmidt authored Jan 9, 2025
1 parent d5b7770 commit 3838f7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/spina/embeds/youtube.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Youtube < Base

heroicon "video-camera"

REGEX = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/
REGEX = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|shorts\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/

validates :url, presence: true, format: {with: REGEX}

Expand Down

0 comments on commit 3838f7b

Please sign in to comment.