X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParser.java;h=7194b89214dcb89743c6cd615e6cba69bf26a6f9;hb=52c5e4136f8251b504941d662dba7b2ffc33863d;hp=a1675d7178a8ba1c0acbbeab86291abb70f11923;hpb=45ac9553fbf9bf618adc15614c9329e64b835d55;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index a1675d7..7194b89 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -204,19 +204,13 @@ public class SoneTextParser implements Parser { continue; } if (linkType == LinkType.POST) { - if (line.length() >= (7 + 36)) { - String postId = line.substring(7, 43); - Optional post = postProvider.getPost(postId); - if (post.isPresent()) { - parts.add(new PostPart(post.get())); - } else { - parts.add(new PlainTextPart(line.substring(0, 43))); - } - line = line.substring(43); + Optional post = postProvider.getPost(link.substring(7)); + if (post.isPresent()) { + parts.add(new PostPart(post.get())); } else { - parts.add(new PlainTextPart(line)); - line = ""; + parts.add(new PlainTextPart(link)); } + line = line.substring(link.length()); continue; }