Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tk is computed incorrectly #8

Open
ghost opened this issue Sep 30, 2020 · 0 comments
Open

tk is computed incorrectly #8

ghost opened this issue Sep 30, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 30, 2020

This code does nothing useful:

token := get(t, ttk)

You can pass any tk token with client=gtx and still get the result. And the token is computed incorrectly anyway. You should have passed the submatch here (matches[1]):

gtranslate/token.go

Lines 119 to 121 in 1bd07f6

matches := regexp.MustCompile(`tkk:\s?'(.+?)'`).FindStringSubmatch(string(body))
if len(matches) > 0 {
v, err := otto.ToValue(matches[0])

Also, otto (unlike goja) incorrectly works with emojis (issue 388), so it will compute an incorrect token every time the text to be translated contains any emoji.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants