From 9607fe03af8dc02a53ffd05df6f815e675bfadae Mon Sep 17 00:00:00 2001 From: bbielsa Date: Wed, 3 Nov 2021 00:45:03 -0400 Subject: [PATCH] Detect the type of subscription import format based on the content type of the file uploaded --- src/invidious.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 3a358c20..bdecff1d 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -746,6 +746,8 @@ post "/data_control" do |env| HTTP::FormData.parse(env.request) do |part| body = part.body.gets_to_end + type = part.headers["Content-Type"] + next if body.empty? # TODO: Unify into single import based on content-type @@ -816,12 +818,12 @@ post "/data_control" do |env| end end when "import_youtube" - if body[0..4] == "