[Glitch] Fix error with remote tags including percent signs

Port c5eca8ffb2 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo
2025-11-14 15:11:41 +01:00
committed by Claire
parent 8240644b6e
commit ee257dc307

View File

@@ -133,12 +133,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)}
@@ -192,7 +194,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'