diff options
| author | tusooa <tusooa@kazv.moe> | 2023-07-21 13:54:10 -0400 |
|---|---|---|
| committer | tusooa <tusooa@kazv.moe> | 2023-07-21 14:03:49 -0400 |
| commit | 0b0b1dabdfa2051d0b1d1ad846892da4801ca588 (patch) | |
| tree | 19b03b4133095a1e5128c4a4441f3289402ed965 /src/services/matcher | |
| parent | 510392e4ca67fee4bf6fed9346f1ff708966e734 (diff) | |
Fix parsing non-ascii tags
Diffstat (limited to 'src/services/matcher')
| -rw-r--r-- | src/services/matcher/matcher.service.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/services/matcher/matcher.service.js b/src/services/matcher/matcher.service.js index b6c4e909..54f02d31 100644 --- a/src/services/matcher/matcher.service.js +++ b/src/services/matcher/matcher.service.js @@ -14,8 +14,11 @@ export const mentionMatchesUrl = (attention, url) => { * @param {string} url */ export const extractTagFromUrl = (url) => { - const regex = /tag[s]*\/(\w+)$/g - const result = regex.exec(url) + const decoded = decodeURI(url) + // https://git.pleroma.social/pleroma/elixir-libraries/linkify/-/blob/master/lib/linkify/parser.ex + // https://www.pcre.org/original/doc/html/pcrepattern.html + const regex = /tag[s]*\/([\p{L}\p{N}_]*[\p{Alphabetic}_·\u{200c}][\p{L}\p{N}_·\p{M}\u{200c}]*)$/ug + const result = regex.exec(decoded) if (!result) { return false } |
