Strip “freenet:” prefix from links.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Nov 2010 10:27:54 +0000 (11:27 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Nov 2010 10:27:54 +0000 (11:27 +0100)
src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java

index 34edc48..85bda1a 100644 (file)
@@ -117,6 +117,10 @@ public class FreenetLinkParser implements Parser {
                                        next = nextUsk;
                                        linkType = LinkType.USK;
                                }
+                               if ((next >= 8) && (line.substring(next - 8, next).equals("freenet:"))) {
+                                       next -= 8;
+                                       line = line.substring(0, next) + line.substring(next + 8);
+                               }
                                Matcher matcher = whitespacePattern.matcher(line);
                                int nextSpace = matcher.find(next) ? matcher.start() : line.length();
                                if (nextSpace > (next + 4)) {