summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2019-10-26 10:17:25 -0400
committerOmar Roth <omarroth@protonmail.com>2019-10-26 10:17:25 -0400
commita1225b6d0dfdfaadcde56e4745e8ad57f107142a (patch)
treeef1965e16c949da27f57df29e903f332990bf324
parent202de1436d812428efbee5f11a2eb60830112800 (diff)
downloadinvidious-a1225b6d0dfdfaadcde56e4745e8ad57f107142a.tar.gz
invidious-a1225b6d0dfdfaadcde56e4745e8ad57f107142a.tar.bz2
invidious-a1225b6d0dfdfaadcde56e4745e8ad57f107142a.zip
Sanitize input to decode_length_seconds
-rw-r--r--src/invidious/helpers/utils.cr2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr
index 5ddc8375..8d4eff9b 100644
--- a/src/invidious/helpers/utils.cr
+++ b/src/invidious/helpers/utils.cr
@@ -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