History

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.

Oliver Eyton-Williams committed 1 year ago

Commit 855cc081 parent cefe1af1 file · +1 −1Browse files

Unified · Split

lib/tasks/docs.thor+1−1
@@ -239,7 +239,7 @@ class DocsCLI < Thor · 238 unmodified lines
239 ['index.json', 'meta.json'].each do |filename|239 ['index.json', 'meta.json'].each do |filename|
240 json = "https://documents.devdocs.io/#{doc.path}/#{filename}?#{time}"240 json = "https://documents.devdocs.io/#{doc.path}/#{filename}?#{time}"
241 begin241 begin
242 URI.open(json) do |file|242 URI.open(json, "Accept-Encoding" => "identity") do |file|
243 mutex.synchronize do243 mutex.synchronize do
244 path = File.join(dir, filename)244 path = File.join(dir, filename)
245 File.write(path, file.read)245 File.write(path, file.read)