Changeset fc229f5 in Klonkt for test/url-linkify.test.js


Ignore:
Timestamp:
07/01/2026 10:20:25 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
e499b71
Parents:
2abd3d2
Message:

fix(fediverse): bracketed mentions/hashtags/URLs link and notify

The mention/hashtag/URL prefix classes required whitespace or '>' before the
token, so "(@user@server)", "(#tag)" and "(https://…)" federated as plain text —
and a bracketed mention's target was never notified (real-world miss on a reply).
Opening brackets are now valid prefixes. Quote characters are deliberately NOT in
the class: a quote precedes attribute values, which must never match.

  • src/services/ActivityPubService.js — prefix class [\s>] → [\s>([{] in linkHashtags, linkUrls, and both mention regexes (scan + per-handle replace).
  • test/url-linkify.test.js — bracketed URL + hashtag link; attribute values stay untouched.
  • CHANGELOG(.nl/.de).md — under Fixed.

Closes prutfolio-src-ovj.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/url-linkify.test.js

    r2abd3d2 rfc229f5  
    4040});
    4141
     42test('a URL inside parentheses links, closing paren stays outside', () => {
     43  const n = note('<p>site (https://example.com/a) hier</p>');
     44  assert.match(n.content, /\(<a href="https:\/\/example\.com\/a"[^>]*>https:\/\/example\.com\/a<\/a>\)/);
     45});
     46
     47test('a hashtag inside parentheses still links; quoted attribute values never match', () => {
     48  const n = note('<p>leuk (#jazz) toch</p>');
     49  assert.match(n.content, /\(<a [^>]*class="mention hashtag"[^>]*>#jazz<\/a>\)/);
     50  // A quote precedes attribute values — the prefix class must NOT include quotes.
     51  const n2 = note('<p>plaatje <a href="https://x.example/#frag">link</a></p>');
     52  assert.equal((n2.content.match(/<a /g) || []).length, 1, 'href value untouched');
     53});
     54
    4255test('attribute values are untouched, standalone URLs still link (image stripped from content)', () => {
    4356  const n = note('<p><img src="https://cdn.example.com/pic.png" alt=""> and https://example.org</p>');
Note: See TracChangeset for help on using the changeset viewer.