refactor(Quotes): inlcude URL scheme in quote regex

This should increase the performance, whilst rejecting more incorrect
URLs and allowing more correct ones.
This commit is contained in:
FineFindus 2024-07-30 21:51:36 +02:00
parent 117037e7e8
commit 4b6c6cbcfe
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
1 changed files with 2 additions and 2 deletions

View File

@ -87,7 +87,7 @@ public abstract class StatusDisplayItem{
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,8}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)$");
private final static Pattern QUOTE_PATTERN=Pattern.compile("https://[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,8}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)$");
public void setAncestryInfo(
boolean hasDescendantNeighbor,
@ -426,7 +426,7 @@ public abstract class StatusDisplayItem{
if(!matcher.find())
return;
String quoteURL="https://"+matcher.group();
String quoteURL=matcher.group();
if (UiUtils.looksLikeFediverseUrl(quoteURL)) {
new GetSearchResults(quoteURL, GetSearchResults.Type.STATUSES, true, null, 0, 0).setCallback(new Callback<>(){