From 25c8cd92463e9cd31ce8b20457ea09d32fcb62c7 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 28 Oct 2019 06:17:39 -0400 Subject: [PATCH] Fix escaping for search params --- src/invidious/search.cr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/invidious/search.cr b/src/invidious/search.cr index cc9c9634..ca3ae4d7 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -361,9 +361,14 @@ def produce_search_params(sort : String = "relevance", date : String = "", conte end end + if object["2:embedded"].as(Hash).empty? + object.delete("2:embedded") + end + params = object.try { |i| Protodec::Any.cast_json(object) } .try { |i| Protodec::Any.from_json(i) } - .try { |i| Base64.urlsafe_encode(i, padding: false) } + .try { |i| Base64.urlsafe_encode(i) } + .try { |i| URI.encode_www_form(i) } return params end