From 3846f721ca015ab39a7e4b8d3f3d61163a6f1650 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 21 Sep 2023 23:42:20 +0200 Subject: [PATCH] fix: Only open files for reading and writing if writeable --- revanced-lib/src/main/kotlin/app/revanced/lib/zip/ZipFile.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revanced-lib/src/main/kotlin/app/revanced/lib/zip/ZipFile.kt b/revanced-lib/src/main/kotlin/app/revanced/lib/zip/ZipFile.kt index c4054c0..217f21e 100644 --- a/revanced-lib/src/main/kotlin/app/revanced/lib/zip/ZipFile.kt +++ b/revanced-lib/src/main/kotlin/app/revanced/lib/zip/ZipFile.kt @@ -13,7 +13,7 @@ import java.util.zip.Deflater class ZipFile(file: File) : Closeable { private var entries: MutableList = mutableListOf() - private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw") + private val filePointer: RandomAccessFile = RandomAccessFile(file, if (file.canWrite()) "rw" else "r") private var centralDirectoryNeedsRewrite = false private val compressionLevel = 5