From a5fb1d38e04298a6dfd8b4851052091db04d628f Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Tue, 7 Aug 2018 10:01:46 -0500 Subject: [PATCH] Fix non-existent 'content_html' on empty comment section --- src/invidious.cr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/invidious.cr b/src/invidious.cr index 30a27058..ce518a08 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1708,7 +1708,12 @@ get "/api/v1/comments/:id" do |env| ctoken = body.match(/'COMMENTS_TOKEN': "(?[^"]+)"/) if !ctoken env.response.content_type = "application/json" + + if format == "json" next {"comments" => [] of String}.to_json + else + next {"content_html" => ""}.to_json + end end ctoken = ctoken["ctoken"] itct = body.match(/itct=(?[^"]+)"/).not_nil!["itct"]