From 81d59ef9caf9377b95662f5887477755b19317eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 9 Aug 2011 01:11:52 +0200 Subject: [PATCH] Filter links when creating replies, too. This fixes #222. --- src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java | 2 ++ src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java index aae5e83..2b12352 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java @@ -19,6 +19,7 @@ package net.pterodactylus.sone.web; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.text.TextFilter; import net.pterodactylus.sone.web.page.Page.Request.Method; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -63,6 +64,7 @@ public class CreateReplyPage extends SoneTemplatePage { if (sender == null) { sender = getCurrentSone(request.getToadletContext()); } + text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text); webInterface.getCore().createReply(sender, post, text); throw new RedirectException(returnPage); } diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java index 9ed960f..ce78f58 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java @@ -20,6 +20,7 @@ package net.pterodactylus.sone.web.ajax; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.text.TextFilter; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.util.json.JsonObject; @@ -60,6 +61,7 @@ public class CreateReplyAjaxPage extends JsonPage { if ((post == null) || (post.getSone() == null)) { return createErrorJsonObject("invalid-post-id"); } + text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text); Reply reply = webInterface.getCore().createReply(sender, post, text); return createSuccessJsonObject().put("reply", reply.getId()).put("sone", sender.getId()); } -- 2.7.4