server: try to fix link parsing from wafrn.net
Some checks failed
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline failed
Some checks failed
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline failed
Changelog: Fixed
This commit is contained in:
parent
ada577bde6
commit
b94aeb2df2
1 changed files with 5 additions and 3 deletions
|
@ -68,14 +68,16 @@ export function fromHtml(html: string, quoteUri?: string | null): string {
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
{
|
{
|
||||||
const txt = getText(node);
|
// trim spaces away, because some AP servers (app.wafrn.net) send strange
|
||||||
|
// zero width non-break space in strange places and things like that
|
||||||
|
const txt = getText(node).trim();
|
||||||
const href = getAttr(node, 'href');
|
const href = getAttr(node, 'href');
|
||||||
|
|
||||||
// hashtags
|
// hashtags
|
||||||
if (txt.startsWith('#') && href && (attrHas(node, 'rel', 'tag') || attrHas(node, 'class', 'hashtag'))) {
|
if (txt.startsWith('#') && href && (attrHas(node, 'rel', 'tag') || attrHas(node, 'class', 'hashtag'))) {
|
||||||
text += txt;
|
text += txt;
|
||||||
// mentions
|
// mentions: a link that starts with `@` and does not include space
|
||||||
} else if (txt.startsWith('@') && !attrHas(node, 'rel', 'me')) {
|
} else if (txt.startsWith('@') && txt.match(/\s/) == null && !attrHas(node, 'rel', 'me')) {
|
||||||
const part = txt.split('@');
|
const part = txt.split('@');
|
||||||
|
|
||||||
if (part.length === 2 && href) {
|
if (part.length === 2 && href) {
|
||||||
|
|
Loading…
Reference in a new issue