X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteAlbumPage.kt;h=bd86c954c28ecb62d0f4d53330158d82bdf980a7;hp=d55c7cbd5ef0fb495c23f66fbb5baebbc1d393e4;hb=HEAD;hpb=03cec6a6772c2d836d94864adddaf544cbe9d72f diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt index d55c7cb..bd86c95 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt @@ -18,18 +18,18 @@ class DeleteAlbumPage @Inject constructor(webInterface: WebInterface, loaders: L override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { - val album = soneRequest.core.getAlbum(soneRequest.httpRequest.getPartAsStringFailsafe("album", 36)) ?: throw RedirectException("invalid.html") + val album = soneRequest.core.getAlbum(soneRequest.httpRequest.getPartAsStringFailsafe("album", 36)) ?: redirectTo("invalid.html") if (!album.sone.isLocal) { - throw RedirectException("noPermission.html") + redirectTo("noPermission.html") } if (soneRequest.httpRequest.getPartAsStringFailsafe("abortDelete", 4) == "true") { - throw RedirectException("imageBrowser.html?album=${album.id}") + redirectTo("imageBrowser.html?album=${album.id}") } soneRequest.core.deleteAlbum(album) - throw RedirectException(if (album.parent.isRoot) "imageBrowser.html?sone=${album.sone.id}" else "imageBrowser.html?album=${album.parent.id}") + redirectTo(if (album.parent.isRoot) "imageBrowser.html?sone=${album.sone.id}" else "imageBrowser.html?album=${album.parent.id}") } val album = soneRequest.core.getAlbum(soneRequest.httpRequest.getParam("album")) - templateContext["album"] = album ?: throw RedirectException("invalid.html") + templateContext["album"] = album ?: redirectTo("invalid.html") } }