File tree Expand file tree Collapse file tree 1 file changed +26
-21
lines changed
Expand file tree Collapse file tree 1 file changed +26
-21
lines changed Original file line number Diff line number Diff line change @@ -137,28 +137,11 @@ impl<'a> DecompressionStruct<'a> {
137137 }
138138 let mut output = self . writer . get_mut ( ) . split ( ) ;
139139 if !self . is_encodings_empty ( ) {
140- output = decompress_multi (
141- & output,
142- & mut self . writer ,
143- & self . encoding_info ,
144- )
145- . map_err ( |e| {
146- self . push_last_encoding ( last_encoding. clone ( ) ) ;
147- if e. is_corrupt ( ) {
148- let header_index = self . encoding_info . len ( ) ;
149- let compression_index = self . last_compression_index ( ) ;
150- let partial_error = e. from_corrupt_to_partial (
151- output,
152- header_index,
153- compression_index,
154- ) ;
155- return partial_error;
156- }
157- e
158- } ) ?;
140+ self . try_decompress_chain_remaining ( output, last_encoding)
141+ } else {
142+ self . push_last_encoding ( last_encoding) ;
143+ Ok ( output)
159144 }
160- self . push_last_encoding ( last_encoding) ;
161- Ok ( output)
162145 }
163146
164147 // Errors:
@@ -189,6 +172,28 @@ impl<'a> DecompressionStruct<'a> {
189172 }
190173 Ok ( ( ) )
191174 }
175+
176+ fn try_decompress_chain_remaining (
177+ & mut self ,
178+ mut input : BytesMut ,
179+ last_encoding : ContentEncoding ,
180+ ) -> Result < BytesMut , MultiDecompressError > {
181+ decompress_multi ( & input, & mut self . writer , & self . encoding_info )
182+ . map_err ( |e| {
183+ self . push_last_encoding ( last_encoding) ;
184+ if e. is_corrupt ( ) {
185+ let header_index = self . encoding_info . len ( ) ;
186+ let compression_index = self . last_compression_index ( ) ;
187+ let partial_error = e. from_corrupt_to_partial (
188+ input,
189+ header_index,
190+ compression_index,
191+ ) ;
192+ return partial_error;
193+ }
194+ e
195+ } )
196+ }
192197}
193198
194199#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments