Skip to content

Commit

Permalink
enhance(Mention): add support for users/
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Oct 21, 2023
1 parent ed1a47d commit 0fecff1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/soapbox/components/status-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ const StatusContent: React.FC<IStatusContent> = ({
return (<Mention mention={mention} />);
} else if (node.attribs.href) {
// User is not present in database, construct acct from url
const matches = [...node.attribs.href.matchAll(/^http(?:s)?:\/\/(\S+)\/@(\S+)/gm)][0];
const matches = [...node.attribs.href.matchAll(/^http(?:s)?:\/\/((?:[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,})\/(?:@|users?\/)(\S+)/gm)][0];

if (matches) {
return (<Mention mention={{ acct: `${matches[2]}@${matches[1]}`, url: node.attribs.href, id: '', username: '' }} />);
return (<Mention mention={{ acct: `${matches[3]}@${matches[1]}`, url: node.attribs.href, id: '', username: '' }} />);
}
}
}
Expand Down

0 comments on commit 0fecff1

Please sign in to comment.