From bc758d17e2ac5c507117f85bf76b081a05f2baca Mon Sep 17 00:00:00 2001 From: nea Date: Sat, 14 Oct 2023 22:58:40 +0200 Subject: Fix hitting file limit when downloading repo --- src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt index 18f8e49..ffb4b6e 100644 --- a/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt +++ b/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt @@ -110,12 +110,13 @@ object RepoDownloadManager { entry.name.substringAfter('/', missingDelimiterValue = "") ) if (repoSavedLocation !in extractedLocation.iterate { it.parent }) { - logger.error("Not Enough Updates detected an invalid zip file. This is a potential security risk, please report this in the Moulberry discord.") - throw RuntimeException("Not Enough Updates detected an invalid zip file. This is a potential security risk, please report this in the Moulberry discord.") + logger.error("Firmament detected an invalid zip file. This is a potential security risk, please report this in the Firmament discord.") + throw RuntimeException("Firmament detected an invalid zip file. This is a potential security risk, please report this in the Firmament discord.") } extractedLocation.parent.createDirectories() - cis.copyTo(extractedLocation.outputStream()) - cis.closeEntry() + cis.use { + extractedLocation.outputStream().use { cis.copyTo(it) } + } } } } -- cgit