onebox 2.2.18 → 2.2.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad985f078d3e4921cca20227fc12ceecca0c4afe8566208efc94206fffd6c6eb
4
- data.tar.gz: aa4599d2ac43b4ef6be8297732b1c27ef30709c33b0cf9d7cc9916f7091428f3
3
+ metadata.gz: 6a892a3207f5adc40ff6c9924e52cfaa41e332c0890dfb52df2a15476900ec9a
4
+ data.tar.gz: 9fee19ab2aafa30845f6a44852e5ee6822fd702b762597740dee28c6136374ad
5
5
  SHA512:
6
- metadata.gz: d2e5037b2c8e91d42dd35070cb9a175142054c3ae7d0e16cee40d9f2f3e6aeee93c37d5105a34e41d46e47588b31658fd964f1f3f8ff6e06604fbd3fb625cde0
7
- data.tar.gz: 6d0deb951f8b080263b84325f0fc74b6b37b0b6c18bf6aa81f31f7fb7d1d15d39d5ca25a0850304ff6251a4aab09af83adbd2a9484776303886962503edf0286
6
+ metadata.gz: dae1b6efe6dede26280478b904c9fa7fb128bdddc42f7b751b8acbaa80cbd1ba2b7717093105c12cef376fc754faf53f0fc5989fb94c9927925369c4f9527f7b
7
+ data.tar.gz: e5243223f4206de9b7bba0af587512dd786515f28687a5939b0cabfa71d91bc8742f0d75cbaffc272e8a6c00cae26feeca0999ebb7d611a650be2149ca718a99
@@ -89,25 +89,31 @@ module Onebox
89
89
 
90
90
  def video_id
91
91
  @video_id ||= begin
92
+ id = nil
93
+
92
94
  # http://youtu.be/afyK1HSFfgw
93
95
  if uri.host["youtu.be"]
94
96
  id = uri.path[/\/([\w\-]+)/, 1]
95
- return id if id
96
97
  end
97
98
 
98
99
  # https://www.youtube.com/embed/vsF0K3Ou1v0
99
100
  if uri.path["/embed/"]
100
- id = uri.path[/\/embed\/([\w\-]+)/, 1]
101
- return id if id
101
+ id ||= uri.path[/\/embed\/([\w\-]+)/, 1]
102
102
  end
103
103
 
104
104
  # https://www.youtube.com/watch?v=Z0UISCEe52Y
105
- params['v']
105
+ id ||= params['v']
106
+
107
+ sanitize_yt_id(id)
106
108
  end
107
109
  end
108
110
 
109
111
  def list_id
110
- @list_id ||= params['list']
112
+ @list_id ||= sanitize_yt_id(params['list'])
113
+ end
114
+
115
+ def sanitize_yt_id(raw)
116
+ raw&.match?(/\A[\w-]+\z/) ? raw : nil
111
117
  end
112
118
 
113
119
  def embed_params
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "2.2.18"
4
+ VERSION = "2.2.19"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.18
4
+ version: 2.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta