encode all unsafe characters in post text for translate URL (#1345)

zio/stable
Eric Bailey 2023-08-31 18:39:18 -05:00 committed by GitHub
parent d2e65d2a7f
commit ba393cd642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -80,5 +80,7 @@ export function isPostInLanguage(
} }
export function getTranslatorLink(text: string): string { export function getTranslatorLink(text: string): string {
return encodeURI(`https://translate.google.com/?sl=auto&text=${text}`) return `https://translate.google.com/?sl=auto&text=${encodeURIComponent(
text,
)}`
} }