mirror of https://github.com/iv-org/invidious.git
Sanitize input to decode_length_seconds
This commit is contained in:
parent
202de1436d
commit
a1225b6d0d
|
@ -1675,7 +1675,7 @@ def make_client(url : URI, region = nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def decode_length_seconds(string)
|
def decode_length_seconds(string)
|
||||||
length_seconds = string.split(":").map { |a| a.to_i }
|
length_seconds = string.gsub(/[^0-9:]/, "").split(":").map &.to_i
|
||||||
length_seconds = [0] * (3 - length_seconds.size) + length_seconds
|
length_seconds = [0] * (3 - length_seconds.size) + length_seconds
|
||||||
length_seconds = Time::Span.new(length_seconds[0], length_seconds[1], length_seconds[2])
|
length_seconds = Time::Span.new(length_seconds[0], length_seconds[1], length_seconds[2])
|
||||||
length_seconds = length_seconds.total_seconds.to_i
|
length_seconds = length_seconds.total_seconds.to_i
|
||||||
|
|
Loading…
Reference in New Issue