From: Lanius Trolling Date: Sun, 22 Dec 2024 19:38:47 +0000 (-0500) Subject: Fix WebDAV deletion results X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=7b844fef76bc29a766745efbad60696a6c9e6b99;p=factbooks Fix WebDAV deletion results --- diff --git a/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt b/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt index 0425c37..c33a6df 100644 --- a/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt +++ b/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt @@ -177,13 +177,13 @@ suspend fun FileStorage.copyWebDav(source: StoragePath, target: StoragePath): Bo } } -suspend fun FileStorage.deleteWebDav(path: StoragePath): Boolean { +suspend fun FileStorage.deleteWebDav(path: StoragePath): Boolean? { return when (getType(path)) { StoredFileType.DIRECTORY -> deleteDir(path) StoredFileType.FILE -> eraseFile(path) - null -> false + null -> null } } @@ -313,7 +313,7 @@ suspend fun ApplicationCall.webDavPut(path: StoragePath) { val body = receive() - if (!FileStorage.instance.deleteWebDav(path)) + if (FileStorage.instance.deleteWebDav(path) == false) return respond(HttpStatusCode.Conflict) if (FileStorage.instance.writeFile(path, body)) @@ -341,7 +341,7 @@ suspend fun ApplicationCall.webDavMove(path: StoragePath) { if (!FileStorage.instance.copyWebDav(path, dest)) return respond(HttpStatusCode.NotFound) - if (FileStorage.instance.deleteWebDav(path)) + if (FileStorage.instance.deleteWebDav(path) != false) respond(HttpStatusCode.NoContent) else respond(HttpStatusCode.Conflict) @@ -350,7 +350,7 @@ suspend fun ApplicationCall.webDavMove(path: StoragePath) { suspend fun ApplicationCall.webDavDelete(path: StoragePath) { beforeWebDav() - if (FileStorage.instance.deleteWebDav(path)) + if (FileStorage.instance.deleteWebDav(path) == true) respond(HttpStatusCode.NoContent) else respond(HttpStatusCode.NotFound)