mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 03:25:14 +00:00
Fix error with remote tags including percent signs (#36886)
This commit is contained in:
parent
a7b45682a6
commit
6486c092f6
1 changed files with 7 additions and 5 deletions
|
|
@ -27,12 +27,14 @@ export const HandledLink: FC<HandledLinkProps & ComponentProps<'a'>> = ({
|
||||||
}) => {
|
}) => {
|
||||||
// Handle hashtags
|
// Handle hashtags
|
||||||
if (
|
if (
|
||||||
text.startsWith('#') ||
|
(text.startsWith('#') ||
|
||||||
prevText?.endsWith('#') ||
|
prevText?.endsWith('#') ||
|
||||||
text.startsWith('#') ||
|
text.startsWith('#') ||
|
||||||
prevText?.endsWith('#')
|
prevText?.endsWith('#')) &&
|
||||||
|
!text.includes('%')
|
||||||
) {
|
) {
|
||||||
const hashtag = text.slice(1).trim();
|
const hashtag = text.slice(1).trim();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
className={classNames('mention hashtag', className)}
|
className={classNames('mention hashtag', className)}
|
||||||
|
|
@ -69,7 +71,7 @@ export const HandledLink: FC<HandledLinkProps & ComponentProps<'a'>> = ({
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
{...props}
|
{...props}
|
||||||
href={href}
|
href={encodeURI(href)}
|
||||||
title={href}
|
title={href}
|
||||||
className={classNames('unhandled-link', className)}
|
className={classNames('unhandled-link', className)}
|
||||||
target='_blank'
|
target='_blank'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue