From 3dc980e80051cf1d5dc4a224fb57823612c4bc94 Mon Sep 17 00:00:00 2001 From: Frank de Lange Date: Tue, 12 Oct 2021 20:17:45 +0200 Subject: [PATCH] Fix for #2488 - parse contents of search results of type=Category (#2496) * Fix for #2488 - parse contents of search results of type=Category (returned on first page for universal (type=all) queries instead of returning an error. * Moved content array walker to Category#to_json As requested by reviewer this change moves the content array walker from the API endpoint to the Category class. * Update src/invidious/helpers/serialized_yt_data.cr Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com> --- src/invidious/helpers/serialized_yt_data.cr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.cr index 61356555..a9798f0c 100644 --- a/src/invidious/helpers/serialized_yt_data.cr +++ b/src/invidious/helpers/serialized_yt_data.cr @@ -237,8 +237,15 @@ class Category def to_json(locale, json : JSON::Builder) json.object do + json.field "type", "category" json.field "title", self.title - json.field "contents", self.contents + json.field "contents" do + json.array do + self.contents.each do |item| + item.to_json(locale, json) + end + end + end end end