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=8009c72e2bbba1885996ca530273611c817e743a;hp=9e6bf386e74a77f6c830b665c68c1406c7a429e8;hb=05fb821e72072bde52f383bdc5a988da67f66d0c;hpb=f0c1becb30b360bf414ca9cbdd5df61490a9393c 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 9e6bf38..8009c72 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt @@ -14,9 +14,8 @@ class DeleteAlbumPage(template: Template, webInterface: WebInterface): SoneTemplatePage("deleteAlbum.html", template, "Page.DeleteAlbum.Title", webInterface, true) { override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - val album = webInterface.core.getAlbum(request.httpRequest.getPartAsStringFailsafe("album", 36)) - templateContext["album"] = album ?: throw RedirectException("invalid.html") if (request.isPOST) { + val album = webInterface.core.getAlbum(request.httpRequest.getPartAsStringFailsafe("album", 36)) ?: throw RedirectException("invalid.html") if (!album.sone.isLocal) { throw RedirectException("noPermission.html") } @@ -26,6 +25,8 @@ class DeleteAlbumPage(template: Template, webInterface: WebInterface): webInterface.core.deleteAlbum(album) throw RedirectException(if (album.parent.isRoot) "imageBrowser.html?sone=${album.sone.id}" else "imageBrowser.html?album=${album.parent.id}") } + val album = webInterface.core.getAlbum(request.httpRequest.getParam("album")) + templateContext["album"] = album ?: throw RedirectException("invalid.html") } }