mirror of
https://github.com/iv-org/invidious.git
synced 2026-11-05 19:37:16 +00:00
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
This commit is contained in:
@@ -82,18 +82,21 @@ module Invidious::Routes::Subscriptions
|
|||||||
if action_takeout
|
if action_takeout
|
||||||
env.response.content_type = "application/json"
|
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")
|
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"
|
if format == "json"
|
||||||
|
env.response.headers["Content-Disposition"] = "attachment; filename=\"invidious_subscriptions_#{export_time}\""
|
||||||
return Invidious::User::Export.to_invidious(user)
|
return Invidious::User::Export.to_invidious(user)
|
||||||
elsif format == "newpipe_json"
|
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)
|
return Invidious::User::Export.to_newpipe(subscriptions)
|
||||||
else
|
else
|
||||||
env.response.content_type = "application/xml"
|
env.response.content_type = "application/xml"
|
||||||
|
env.response.headers["Content-Disposition"] = "attachment; filename=\"invidious_subscriptions_#{export_time}.opml\""
|
||||||
|
|
||||||
export = XML.build do |xml|
|
export = XML.build do |xml|
|
||||||
xml.element("opml", version: "1.1") do
|
xml.element("opml", version: "1.1") do
|
||||||
xml.element("body") do
|
xml.element("body") do
|
||||||
|
|||||||
Reference in New Issue
Block a user