X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteImagePage.kt;h=61db304275d9731cc8c5e66d47cea00a10dd3bc0;hp=de118be9f65fe57d1d88986983806ec045352524;hb=3cb0e2c78bb37f2d70ecde92ad4fcf642de788a3;hpb=cec099ef08feaff5332b81885ad989dbcb0fdfba diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt index de118be..61db304 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt @@ -12,19 +12,19 @@ import net.pterodactylus.util.template.TemplateContext class DeleteImagePage(template: Template, webInterface: WebInterface): SoneTemplatePage("deleteImage.html", template, "Page.DeleteImage.Title", webInterface, true) { - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - if (request.isPOST) { - val image = webInterface.core.getImage(request.httpRequest.getPartAsStringFailsafe("image", 36)) ?: throw RedirectException("invalid.html") + override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { + if (freenetRequest.isPOST) { + val image = webInterface.core.getImage(freenetRequest.httpRequest.getPartAsStringFailsafe("image", 36)) ?: throw RedirectException("invalid.html") if (!image.sone.isLocal) { throw RedirectException("noPermission.html") } - if (request.httpRequest.isPartSet("abortDelete")) { + if (freenetRequest.httpRequest.isPartSet("abortDelete")) { throw RedirectException("imageBrowser.html?image=${image.id}") } webInterface.core.deleteImage(image) throw RedirectException("imageBrowser.html?album=${image.album.id}") } - val image = webInterface.core.getImage(request.httpRequest.getParam("image")) ?: throw RedirectException("invalid.html") + val image = webInterface.core.getImage(freenetRequest.httpRequest.getParam("image")) ?: throw RedirectException("invalid.html") if (!image.sone.isLocal) { throw RedirectException("noPermission.html") }