Use stringz.length instead of String.length in hashtag length calculation (#5443)
* Use stringz.length instead of String.length * length to 128, ignore combining
This commit is contained in:
parent
53fba9b137
commit
0f2d392b4b
2 changed files with 2 additions and 2 deletions
|
@ -148,7 +148,7 @@ export const mfmLanguage = P.createLanguage({
|
|||
if (hashtag.match(/^(\u20e3|\ufe0f)/)) return P.makeFailure(i, 'not a hashtag');
|
||||
if (hashtag.match(/^[0-9]+$/)) return P.makeFailure(i, 'not a hashtag');
|
||||
if (input[i - 1] != null && input[i - 1].match(/[a-z0-9]/i)) return P.makeFailure(i, 'not a hashtag');
|
||||
if (hashtag.length > 50) return P.makeFailure(i, 'not a hashtag');
|
||||
if (Array.from(hashtag || '').length > 128) return P.makeFailure(i, 'not a hashtag');
|
||||
return P.makeSuccess(i + ('#' + hashtag).length, createLeaf('hashtag', { hashtag: hashtag }));
|
||||
}),
|
||||
url: () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue