Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d3f772c authored by Diksha Gohlyan's avatar Diksha Gohlyan
Browse files

If size of file equals zero, still compress

Bug: 166357013
Test: atest DocumentsUIUnitTests

Change-Id: I051da77bea0ac5f628039278ae26929c707052ee
parent ed7ac98a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -20,16 +20,16 @@ import android.text.TextUtils;

import androidx.annotation.NonNull;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveInputStream;
import org.apache.commons.compress.archivers.sevenz.SevenZFile;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;

/**
 * To simulate the input stream by using ZipFile, SevenZFile, or ArchiveInputStream.
 */
@@ -124,7 +124,7 @@ abstract class ArchiveEntryInputStream extends InputStream {
            throw new IllegalArgumentException("ArchiveEntry is empty");
        }

        if (archiveEntry.isDirectory() || archiveEntry.getSize() <= 0
        if (archiveEntry.isDirectory() || archiveEntry.getSize() < 0
                || TextUtils.isEmpty(archiveEntry.getName())) {
            throw new IllegalArgumentException("ArchiveEntry is an invalid file entry");
        }