From: David ‘Bombe’ Roden Date: Sat, 27 Nov 2010 10:27:54 +0000 (+0100) Subject: Strip “freenet:” prefix from links. X-Git-Tag: 0.3.2-RC1~20 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f3beba50c66473b89594743c7e790e49fd4d9ad9;p=Sone.git Strip “freenet:” prefix from links. --- diff --git a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java index 34edc48..85bda1a 100644 --- a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java +++ b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java @@ -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)) {