X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteAlbumPage.kt;h=8009c72e2bbba1885996ca530273611c817e743a;hb=8da648b3e2b33064cb72aa87c4dc198b60bf0a7f;hp=9e6bf386e74a77f6c830b665c68c1406c7a429e8;hpb=de7568a82eb4150bf6d2b0553841b7b69f84c968;p=Sone.git 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") } }