From 5a1d5a053a6f9513c792c50481bbc66be8ea55a5 Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR Date: Tue, 15 Oct 2024 16:16:15 -0300 Subject: [PATCH] Fix missing class discriminators --- .../backend/routes/api/v1/PostUploadFileRoute.kt | 10 +++++----- build.gradle.kts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/routes/api/v1/PostUploadFileRoute.kt b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/routes/api/v1/PostUploadFileRoute.kt index a892850..c94096f 100644 --- a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/routes/api/v1/PostUploadFileRoute.kt +++ b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/routes/api/v1/PostUploadFileRoute.kt @@ -21,13 +21,13 @@ class PostUploadFileRoute(val m: EtherealGambi) : BaseRoute("/api/v1/upload") { override suspend fun onRequest(call: ApplicationCall) { val authorization = call.request.header("Authorization") if (authorization == null) { - call.respondText(Json.encodeToString(UploadFileResponse.Unauthorized)) + call.respondText(Json.encodeToString(UploadFileResponse.Unauthorized)) return } val authorizationToken = m.config.authorizationTokens.firstOrNull { it.token == authorization } if (authorizationToken == null) { - call.respondText(Json.encodeToString(UploadFileResponse.Unauthorized)) + call.respondText(Json.encodeToString(UploadFileResponse.Unauthorized)) return } @@ -36,14 +36,14 @@ class PostUploadFileRoute(val m: EtherealGambi) : BaseRoute("/api/v1/upload") { val fileData = Base64.getDecoder().decode(request.dataBase64) if (request.path.contains("..")) { - call.respondText(Json.encodeToString(UploadFileResponse.PathTraversalDisallowed)) + call.respondText(Json.encodeToString(UploadFileResponse.PathTraversalDisallowed)) return } val writeToPath = "/${authorizationToken.folder}/${request.path}" val file = File(m.files, writeToPath) if (request.failIfFileAlreadyExists && file.exists()) { - call.respondText(Json.encodeToString(UploadFileResponse.FileAlreadyExists)) + call.respondText(Json.encodeToString(UploadFileResponse.FileAlreadyExists)) return } @@ -51,6 +51,6 @@ class PostUploadFileRoute(val m: EtherealGambi) : BaseRoute("/api/v1/upload") { folder.mkdirs() file.writeBytes(fileData) - call.respondText(Json.encodeToString(UploadFileResponse.Success(writeToPath))) + call.respondText(Json.encodeToString(UploadFileResponse.Success(writeToPath))) } } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 7336a46..68cde90 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { allprojects { group = "net.perfectdreams.etherealgambi" - version = "1.0.2" + version = "1.0.3" repositories { mavenCentral()