Don't double-encode file title
This commit is contained in:
parent
2f335b3d2c
commit
004e371051
|
@ -164,7 +164,9 @@ module Invidious::Routes::VideoPlayback
|
||||||
|
|
||||||
if title = query_params["title"]?
|
if title = query_params["title"]?
|
||||||
# https://blog.fastmail.com/2011/06/24/download-non-english-filenames/
|
# https://blog.fastmail.com/2011/06/24/download-non-english-filenames/
|
||||||
env.response.headers["Content-Disposition"] = "attachment; filename=\"#{URI.encode_www_form(title)}\"; filename*=UTF-8''#{URI.encode_www_form(title)}"
|
filename = URI.encode_www_form(title, space_to_plus: false)
|
||||||
|
header = "attachment; filename=\"#{filename}\"; filename*=UTF-8''#{filename}"
|
||||||
|
env.response.headers["Content-Disposition"] = header
|
||||||
end
|
end
|
||||||
|
|
||||||
if !resp.headers.includes_word?("Transfer-Encoding", "chunked")
|
if !resp.headers.includes_word?("Transfer-Encoding", "chunked")
|
||||||
|
|
|
@ -304,12 +304,9 @@ module Invidious::Routes::Watch
|
||||||
end
|
end
|
||||||
|
|
||||||
download_widget = JSON.parse(selection)
|
download_widget = JSON.parse(selection)
|
||||||
extension = download_widget["ext"].as_s
|
|
||||||
|
|
||||||
filename = URI.encode_www_form(
|
extension = download_widget["ext"].as_s
|
||||||
"#{video_id}-#{title}.#{extension}",
|
filename = "#{video_id}-#{title}.#{extension}"
|
||||||
space_to_plus: false
|
|
||||||
)
|
|
||||||
|
|
||||||
# Pass form parameters as URL parameters for the handlers of both
|
# Pass form parameters as URL parameters for the handlers of both
|
||||||
# /latest_version and /api/v1/captions. This avoids an un-necessary
|
# /latest_version and /api/v1/captions. This avoids an un-necessary
|
||||||
|
|
Loading…
Reference in a new issue