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:
parent
117037e7e8
commit
4b6c6cbcfe
1 changed files with 2 additions and 2 deletions
|
@ -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_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(
|
public void setAncestryInfo(
|
||||||
boolean hasDescendantNeighbor,
|
boolean hasDescendantNeighbor,
|
||||||
|
@ -426,7 +426,7 @@ public abstract class StatusDisplayItem{
|
||||||
|
|
||||||
if(!matcher.find())
|
if(!matcher.find())
|
||||||
return;
|
return;
|
||||||
String quoteURL="https://"+matcher.group();
|
String quoteURL=matcher.group();
|
||||||
|
|
||||||
if (UiUtils.looksLikeFediverseUrl(quoteURL)) {
|
if (UiUtils.looksLikeFediverseUrl(quoteURL)) {
|
||||||
new GetSearchResults(quoteURL, GetSearchResults.Type.STATUSES, true, null, 0, 0).setCallback(new Callback<>(){
|
new GetSearchResults(quoteURL, GetSearchResults.Type.STATUSES, true, null, 0, 0).setCallback(new Callback<>(){
|
||||||
|
|
Loading…
Add table
Reference in a new issue