From dee20f92a762048775699110a8cb320506d0084d Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 20 Jan 2022 17:18:17 +0100 Subject: [PATCH] Avoid infinite loop in ChannelVideo's to_xml/to_json methods --- src/invidious/channels/channels.cr | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index 155ec559..46e34dd6 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -44,13 +44,9 @@ struct ChannelVideo end end - def to_json(locale, json : JSON::Builder | Nil = nil) - if json + def to_json(locale, _json : Nil = nil) + JSON.build do |json| to_json(locale, json) - else - JSON.build do |json| - to_json(locale, json) - end end end @@ -88,13 +84,9 @@ struct ChannelVideo end end - def to_xml(locale, xml : XML::Builder | Nil = nil) - if xml + def to_xml(locale, _xml : Nil = nil) + XML.build do |xml| to_xml(locale, xml) - else - XML.build do |xml| - to_xml(locale, xml) - end end end