mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-23 22:27:06 +00:00
fix(chat) - Issue 12217 - Allow url-escapable characters in links. (#12218)
This commit is contained in:
parent
1bc756ee93
commit
85d290a1fa
2 changed files with 8 additions and 1 deletions
|
|
@ -100,6 +100,13 @@ describe('highlightMentions', () => {
|
|||
const result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal('http://www.medium.com/@user/blog [@user](/profile/111)');
|
||||
});
|
||||
|
||||
// https://github.com/HabitRPG/habitica/issues/12217
|
||||
it('doesn\'t highlight user in link with url-escapable characters', async () => {
|
||||
const text = '[test](https://habitica.fandom.com/ru/@wiki/Снаряжение)';
|
||||
const result = await highlightMentions(text);
|
||||
expect(result[0]).to.equal(text);
|
||||
});
|
||||
});
|
||||
|
||||
describe('exceptions in code blocks', () => {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ function toSourceMapRegex (token) {
|
|||
} else if (type === 'link_open') {
|
||||
const texts = token.textContents.map(escapeRegExp);
|
||||
regexStr = markup === 'linkify' || markup === 'autolink' ? texts[0]
|
||||
: `\\[.*${texts.join('.*')}.*\\]\\(${escapeRegExp(token.attrs[0][1])}\\)`;
|
||||
: `\\[.*${texts.join('.*')}.*\\]\\([^)]+\\)`;
|
||||
} else {
|
||||
throw new Error(`No source mapping regex defined for ignore blocks of type ${type}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue