Always use the correct length of the scheme.
[Sone.git] / 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) {