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
This commit is contained in:
schroda
2023-10-31 00:47:23 +01:00
committed by GitHub
parent 5943c6a2c6
commit 5d4d417f3e

View File

@@ -613,16 +613,13 @@ object WebInterfaceManager {
} }
} }
if (!isDownloadValid(zipFile.name, filePath)) { if (!isDownloadValid(filePath)) {
throw Exception("Download is invalid") throw Exception("Download is invalid")
} }
} }
private suspend fun isDownloadValid( private suspend fun isDownloadValid(zipFilePath: String): Boolean {
zipFileName: String, val tempUnzippedWebUIFolderPath = zipFilePath.replace(".zip", "")
zipFilePath: String,
): Boolean {
val tempUnzippedWebUIFolderPath = zipFileName.replace(".zip", "")
extractDownload(zipFilePath, tempUnzippedWebUIFolderPath) extractDownload(zipFilePath, tempUnzippedWebUIFolderPath)