From ea52c05f0505cd0881766dd1ef3efbae4a892d89 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 28 Feb 2019 21:29:01 -0600 Subject: [PATCH] Fix escaping for video filenames --- src/invidious.cr | 3 ++- src/invidious/views/watch.ecr | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 189c256b..e4712d5d 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -4002,7 +4002,8 @@ get "/videoplayback" do |env| env.response.status_code = response.status_code if title = env.params.query["title"]? - env.response.headers["Content-Disposition"] = "attachment; filename=\"#{title}\"" + # https://blog.fastmail.com/2011/06/24/download-non-english-filenames/ + env.response.headers["Content-Disposition"] = "attachment; filename=\"#{URI.escape(title)}\"; filename*=UTF-8''#{URI.escape(title)}" end response.headers.each do |key, value| diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 8f52d2d2..39c46d2e 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -59,17 +59,17 @@