summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/invidious/routes/video_playback.cr4
-rw-r--r--src/invidious/routes/watch.cr7
2 files changed, 5 insertions, 6 deletions
diff --git a/src/invidious/routes/video_playback.cr b/src/invidious/routes/video_playback.cr
index df243945..3a92ef96 100644
--- a/src/invidious/routes/video_playback.cr
+++ b/src/invidious/routes/video_playback.cr
@@ -164,7 +164,9 @@ module Invidious::Routes::VideoPlayback
if title = query_params["title"]?
# 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
if !resp.headers.includes_word?("Transfer-Encoding", "chunked")
diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr
index 7688d2a8..94148bc0 100644
--- a/src/invidious/routes/watch.cr
+++ b/src/invidious/routes/watch.cr
@@ -304,12 +304,9 @@ module Invidious::Routes::Watch
end
download_widget = JSON.parse(selection)
- extension = download_widget["ext"].as_s
- filename = URI.encode_www_form(
- "#{video_id}-#{title}.#{extension}",
- space_to_plus: false
- )
+ extension = download_widget["ext"].as_s
+ filename = "#{video_id}-#{title}.#{extension}"
# Pass form parameters as URL parameters for the handlers of both
# /latest_version and /api/v1/captions. This avoids an un-necessary