Sanitize input to decode_length_seconds

pull/851/head
Omar Roth 5 years ago
parent 202de1436d
commit a1225b6d0d
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

@ -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…
Cancel
Save