Skip to content

Commit ae28afc

Browse files
authored
Allow links to YouTube Shorts in YouTube Embed (#1397)
Support YouTube shorts. The embed markup works without changes.
1 parent 8f7d438 commit ae28afc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/models/spina/embeds/youtube.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Youtube < Base
66

77
heroicon "video-camera"
88

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

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

0 commit comments

Comments
 (0)