diff --git a/lib/fluent/plugin/compressable.rb b/lib/fluent/plugin/compressable.rb index 35fc31123c..aa242478fe 100644 --- a/lib/fluent/plugin/compressable.rb +++ b/lib/fluent/plugin/compressable.rb @@ -64,9 +64,11 @@ def string_decompress(compressed_data) unused = gz.unused gz.finish - break if unused.nil? - adjust = unused.length - io.pos -= adjust + unless unused.nil? + adjust = unused.length + io.pos -= adjust + end + break if io.eof? end out @@ -80,9 +82,11 @@ def io_decompress(input, output) unused = gz.unused gz.finish - break if unused.nil? - adjust = unused.length - input.pos -= adjust + unless unused.nil? + adjust = unused.length + input.pos -= adjust + end + break if input.eof? end output