summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2022-05-07 15:39:23 +0200
committerGitHub <noreply@github.com>2022-05-07 15:39:23 +0200
commitda8a2c7bbbff47e1845c2bc339aae7f727f9ea18 (patch)
tree443b5a213e28ca1270afebdecd4585e4d0b1475e
parentef8c7184de2da3dd143dfc54dcb8f20d0ab67dc8 (diff)
parent81ca205caa5e97767a48ef559dbef2d2330bee8e (diff)
downloadinvidious-da8a2c7bbbff47e1845c2bc339aae7f727f9ea18.tar.gz
invidious-da8a2c7bbbff47e1845c2bc339aae7f727f9ea18.tar.bz2
invidious-da8a2c7bbbff47e1845c2bc339aae7f727f9ea18.zip
Merge pull request #3087 from iv-org/fix-captions-download
Fix download of captions
-rw-r--r--src/invidious/routes/watch.cr17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr
index 867ffa6a..75475430 100644
--- a/src/invidious/routes/watch.cr
+++ b/src/invidious/routes/watch.cr
@@ -308,25 +308,26 @@ module Invidious::Routes::Watch
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
- # redirect and duplicated (and hazardous) sanity checks.
- env.params.query["id"] = video_id
- env.params.query["title"] = filename
-
- # Delete the useless ones
+ # Delete the now useless URL parameters
env.params.body.delete("id")
env.params.body.delete("title")
env.params.body.delete("download_widget")
+ # Pass form parameters as URL parameters for the handlers of both
+ # /latest_version and /api/v1/captions. This avoids an un-necessary
+ # redirect and duplicated (and hazardous) sanity checks.
if label = download_widget["label"]?
# URL params specific to /api/v1/captions/:id
- env.params.query["label"] = URI.encode_www_form(label.as_s, space_to_plus: false)
+ env.params.url["id"] = video_id
+ env.params.query["title"] = filename
+ env.params.query["label"] = URI.decode_www_form(label.as_s)
return Invidious::Routes::API::V1::Videos.captions(env)
elsif itag = download_widget["itag"]?.try &.as_i
# URL params specific to /latest_version
+ env.params.query["id"] = video_id
env.params.query["itag"] = itag.to_s
+ env.params.query["title"] = filename
env.params.query["local"] = "true"
return Invidious::Routes::VideoPlayback.latest_version(env)