Sanitize input to decode_length_seconds

This commit is contained in:
Omar Roth 2019-10-26 10:17:25 -04:00
parent 202de1436d
commit a1225b6d0d
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2
1 changed files with 1 additions and 1 deletions

View File

@ -1675,7 +1675,7 @@ def make_client(url : URI, region = nil)
end
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 = Time::Span.new(length_seconds[0], length_seconds[1], length_seconds[2])
length_seconds = length_seconds.total_seconds.to_i