From 855cc081c65cebb251da61f54daae535de912f53 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Tue, 21 Jan 2025 12:17:23 +0100 Subject: [PATCH] fix: prevent compression with Accept-Encoding It seems that (apparently randomly) the index.json files are getting compressed and causing URI.open to fail. Possibly, it's a little unclear. Nonetheless, sending the "Accept-Encoding" of "identity" seems to do the trick. --- lib/tasks/docs.thor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor index 5b85a8b0..6e953e4f 100644 --- a/lib/tasks/docs.thor +++ b/lib/tasks/docs.thor @@ -239,7 +239,7 @@ class DocsCLI < Thor ['index.json', 'meta.json'].each do |filename| json = "https://documents.devdocs.io/#{doc.path}/#{filename}?#{time}" begin - URI.open(json) do |file| + URI.open(json, "Accept-Encoding" => "identity") do |file| mutex.synchronize do path = File.join(dir, filename) File.write(path, file.read)