Skip to content

Commit

Permalink
Merge pull request #455 from FineFindus/fix/quote=whitespace
Browse files Browse the repository at this point in the history
fix(StatusDisplayItem/Quote): allow whitespace in closing br tag
  • Loading branch information
LucasGGamerM authored Jul 7, 2024
2 parents bc08c14 + 0c95f6d commit ec72653
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public abstract class StatusDisplayItem{
public static final int FLAG_NO_MEDIA_PREVIEW=1 << 8;


private final static Pattern QUOTE_MENTION_PATTERN=Pattern.compile("(?:<p>)?\\s?(?:RE:\\s?(<br\\/?>)?)?<a href=\"https:\\/\\/[^\"]+\"[^>]*><span class=\"invisible\">https:\\/\\/<\\/span><span class=\"ellipsis\">[^<]+<\\/span><span class=\"invisible\">[^<]+<\\/span><\\/a>(?:<\\/p>)?$");
private final static Pattern QUOTE_MENTION_PATTERN=Pattern.compile("(?:<p>)?\\s?(?:RE:\\s?(<br\\s?\\/?>)?)?<a href=\"https:\\/\\/[^\"]+\"[^>]*><span class=\"invisible\">https:\\/\\/<\\/span><span class=\"ellipsis\">[^<]+<\\/span><span class=\"invisible\">[^<]+<\\/span><\\/a>(?:<\\/p>)?$");
private final static Pattern QUOTE_PATTERN=Pattern.compile("[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)$");

public void setAncestryInfo(
Expand Down Expand Up @@ -280,9 +280,6 @@ public static ArrayList<StatusDisplayItem> buildItems(BaseStatusListFragment<?>
Matcher matcher=QUOTE_MENTION_PATTERN.matcher(status.content);
if(matcher.find()){
String quoteMention=matcher.group();
// FIXME: This is ugly. I wanna do it all in the regex >:(
if(statusForContent.content.contains("RE:<br />"+quoteMention))
quoteMention = "RE:<br />"+quoteMention;
statusForContent.content=statusForContent.content.replace(quoteMention, "");
}
}
Expand Down

0 comments on commit ec72653

Please sign in to comment.