diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2023-08-22 20:37:29 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2023-08-22 20:37:29 +0000 |
| commit | cc0a63736a159bc03b77bbd4c62a684d1294e3d2 (patch) | |
| tree | 412229cab310cbbe75acdcf363f6fb2c40f2344c /src | |
| parent | f059c1f314be5979d32cd5726b28fd1b21738972 (diff) | |
| parent | 0b0b1dabdfa2051d0b1d1ad846892da4801ca588 (diff) | |
Merge branch 'tusooa/1274-nonascii-tags' into 'develop'
Fix parsing non-ascii tags
Closes #1274
See merge request pleroma/pleroma-fe!1848
Diffstat (limited to 'src')
| -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 } |
