From: David ‘Bombe’ Roden Date: Fri, 8 Nov 2013 23:39:36 +0000 (+0100) Subject: Always use the correct length of the scheme. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=15b175ec7ed0423bc5a58d1306062458ab0b2a04;p=Sone.git Always use the correct length of the scheme. --- diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index ad4bfff..4f9900a 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -273,7 +273,7 @@ public class SoneTextParser implements Parser { parts.add(new PlainTextPart(link)); } } else if (linkType.isInternetLink()) { - name = link.substring(linkType == LinkType.HTTP ? 7 : 8); + name = link.substring(linkType.getScheme().length()); int firstSlash = name.indexOf('/'); int lastSlash = name.lastIndexOf('/'); if ((lastSlash - firstSlash) > 3) {