Always use the correct length of the scheme.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 8 Nov 2013 23:39:36 +0000 (00:39 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:56 +0000 (22:25 +0100)
src/main/java/net/pterodactylus/sone/text/SoneTextParser.java

index ad4bfff..4f9900a 100644 (file)
@@ -273,7 +273,7 @@ public class SoneTextParser implements Parser<SoneTextParserContext> {
                                                        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) {