From 5d4d417f3e8113a31216e779aacbbb549d867ddc Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:47:23 +0100 Subject: [PATCH] Extract downloaded webUI zip in temp folder for validation (#744) Could cause issues due to not having permission to create the folder to extract the zip into --- .../tachidesk/server/util/WebInterfaceManager.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt index 3ca1e866..5b78072a 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt @@ -613,16 +613,13 @@ object WebInterfaceManager { } } - if (!isDownloadValid(zipFile.name, filePath)) { + if (!isDownloadValid(filePath)) { throw Exception("Download is invalid") } } - private suspend fun isDownloadValid( - zipFileName: String, - zipFilePath: String, - ): Boolean { - val tempUnzippedWebUIFolderPath = zipFileName.replace(".zip", "") + private suspend fun isDownloadValid(zipFilePath: String): Boolean { + val tempUnzippedWebUIFolderPath = zipFilePath.replace(".zip", "") extractDownload(zipFilePath, tempUnzippedWebUIFolderPath)