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

This commit is contained in:
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

View file

@ -80,5 +80,7 @@ export function isPostInLanguage(
}
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,
)}`
}