Merge branch 'fcp-interface' into next
[Sone.git] / src / main / java / net / pterodactylus / sone / text / FreenetLinkParser.java
index 0f6887d..7cb44ce 100644 (file)
@@ -127,18 +127,6 @@ public class FreenetLinkParser implements Parser<FreenetLinkParserContext> {
                        }
                        emptyLines = 0;
                        boolean lineComplete = true;
-
-                       /* filter http(s) links to own node. */
-                       String hostHeader = (context.getRequest() != null) ? context.getRequest().getHttpRequest().getHeader("host") : null;
-                       logger.log(Level.FINEST, "hostHeader: %s", hostHeader);
-                       if (hostHeader != null) {
-                               for (String toRemove : new String[] { "http://" + hostHeader + "/", "https://" + hostHeader + "/", "http://" + hostHeader, "https://" + hostHeader }) {
-                                       while (line.indexOf(toRemove) != -1) {
-                                               line = line.replace(toRemove, "");
-                                       }
-                               }
-                       }
-
                        while (line.length() > 0) {
                                int nextKsk = line.indexOf("KSK@");
                                int nextChk = line.indexOf("CHK@");
@@ -265,7 +253,7 @@ public class FreenetLinkParser implements Parser<FreenetLinkParserContext> {
                                        } else if (linkType == LinkType.POST) {
                                                String postId = link.substring(7);
                                                Post post = core.getPost(postId, false);
-                                               if (post != null) {
+                                               if ((post != null) && (post.getSone() != null)) {
                                                        String postText = post.getText();
                                                        postText = postText.substring(0, Math.min(postText.length(), 20)) + "…";
                                                        Sone postSone = post.getSone();