From e0ff367b49b09d0e35d4a2be70c168e41a494c3f Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 17 Jun 2022 11:50:30 +0100 Subject: [PATCH] DEV: Stop logging error response body in FileHelper (#17120) This doesn't cope well with gzipped, binary, or large responses. Ideally we would teach FinalDestination to safely retrieve and decode some of the response body. But for now, let's remove the broken implementation. --- lib/file_helper.rb | 2 +- spec/lib/file_helper_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/file_helper.rb b/lib/file_helper.rb index 43427c3228..31530a12e9 100644 --- a/lib/file_helper.rb +++ b/lib/file_helper.rb @@ -73,7 +73,7 @@ class FileHelper # attempt error API compatibility io = FakeIO.new io.status = [response.code, ""] - raise OpenURI::HTTPError.new("#{response.code} Error: #{response.body}", io) + raise OpenURI::HTTPError.new("#{response.code} Error", io) else log(:error, "FinalDestination did not work for: #{url}") if verbose throw :done diff --git a/spec/lib/file_helper_spec.rb b/spec/lib/file_helper_spec.rb index ae1d721f52..54c2233a3a 100644 --- a/spec/lib/file_helper_spec.rb +++ b/spec/lib/file_helper_spec.rb @@ -29,7 +29,7 @@ describe FileHelper do expect(e.io.status[0]).to eq("404") raise end - end.to raise_error(OpenURI::HTTPError, "404 Error: 404") + end.to raise_error(OpenURI::HTTPError, "404 Error") end it "does not follow redirects if instructed not to" do