fix: 正規化されていない状態のhashtagが連合されてきたhtmlに含まれているとhashtagが正しくhashtagに復元されない問題を修正 (#13733)
This commit is contained in:
		| @@ -10,6 +10,7 @@ import { Window } from 'happy-dom'; | ||||
| import { DI } from '@/di-symbols.js'; | ||||
| import type { Config } from '@/config.js'; | ||||
| import { intersperse } from '@/misc/prelude/array.js'; | ||||
| import { normalizeForSearch } from '@/misc/normalize-for-search.js'; | ||||
| import type { IMentionedRemoteUsers } from '@/models/Note.js'; | ||||
| import { bindThis } from '@/decorators.js'; | ||||
| import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js'; | ||||
| @@ -33,6 +34,8 @@ export class MfmService { | ||||
| 		// some AP servers like Pixelfed use br tags as well as newlines | ||||
| 		html = html.replace(/<br\s?\/?>\r?\n/gi, '\n'); | ||||
|  | ||||
| 		const normalizedHashtagNames = hashtagNames == null ? undefined : new Set<string>(hashtagNames.map(x => normalizeForSearch(x))); | ||||
|  | ||||
| 		const dom = parse5.parseFragment(html); | ||||
|  | ||||
| 		let text = ''; | ||||
| @@ -85,7 +88,7 @@ export class MfmService { | ||||
| 					const href = node.attrs.find(x => x.name === 'href'); | ||||
|  | ||||
| 					// ハッシュタグ | ||||
| 					if (hashtagNames && href && hashtagNames.map(x => x.toLowerCase()).includes(txt.toLowerCase())) { | ||||
| 					if (normalizedHashtagNames && href && normalizedHashtagNames.has(normalizeForSearch(txt))) { | ||||
| 						text += txt; | ||||
| 					// メンション | ||||
| 					} else if (txt.startsWith('@') && !(rel && rel.value.startsWith('me '))) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 anatawa12
					anatawa12