mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 09:52:16 -05:00
Make sure to close underlying InputStream after decoding attachments
This commit is contained in:
parent
378acbd313
commit
0e03f262b3
@ -39,6 +39,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@ -717,12 +718,24 @@ public class LocalStore extends Store implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
InputStream getDecodingInputStream(InputStream rawInputStream, String encoding) {
|
||||
InputStream getDecodingInputStream(final InputStream rawInputStream, String encoding) {
|
||||
if (MimeUtil.ENC_BASE64.equals(encoding)) {
|
||||
return new Base64InputStream(rawInputStream);
|
||||
return new Base64InputStream(rawInputStream) {
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
rawInputStream.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
if (MimeUtil.ENC_QUOTED_PRINTABLE.equals(encoding)) {
|
||||
return new QuotedPrintableInputStream(rawInputStream);
|
||||
return new QuotedPrintableInputStream(rawInputStream) {
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
rawInputStream.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return rawInputStream;
|
||||
|
Loading…
Reference in New Issue
Block a user