From a1d7429f0791b31f984b5ceeffe3a7ac787c0a15 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Sat, 31 Oct 2026 17:55:10 -0300 Subject: [PATCH] chore+fix: Fix wrong filename for exported subscriptions that are not NewPipe and set correct filenames and extensions for each export Closes https://github.com/iv-org/invidious/issues/6105 --- src/invidious/routes/subscriptions.cr | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/invidious/routes/subscriptions.cr b/src/invidious/routes/subscriptions.cr index e07b62c91..0c2bda315 100644 --- a/src/invidious/routes/subscriptions.cr +++ b/src/invidious/routes/subscriptions.cr @@ -82,18 +82,21 @@ module Invidious::Routes::Subscriptions if action_takeout env.response.content_type = "application/json" - # Exports the NewPipe with the same naming format NewPipe - # uses for their exports - # Exmaple: `newpipe_subscriptions_202610312013` export_time = Time.local.to_s("%Y%m%d%H%M") - env.response.headers["Content-Disposition"] = "attachment; filename=\"newpipe_subscriptions_#{export_time}\"" if format == "json" + env.response.headers["Content-Disposition"] = "attachment; filename=\"invidious_subscriptions_#{export_time}\"" return Invidious::User::Export.to_invidious(user) elsif format == "newpipe_json" + # Exports the NewPipe with the same naming format NewPipe + # uses for their exports + # Exmaple: `newpipe_subscriptions_202610312013` + env.response.headers["Content-Disposition"] = "attachment; filename=\"newpipe_subscriptions_#{export_time}\"" return Invidious::User::Export.to_newpipe(subscriptions) else env.response.content_type = "application/xml" + env.response.headers["Content-Disposition"] = "attachment; filename=\"invidious_subscriptions_#{export_time}.opml\"" + export = XML.build do |xml| xml.element("opml", version: "1.1") do xml.element("body") do