thedaviddelta / lingva-translate

Alternative front-end for Google Translate
https://lingva.thedaviddelta.com
GNU Affero General Public License v3.0
1.52k stars 141 forks source link

encoding slahes/URLs for API requests #68

Open mooseyboots opened 2 years ago

mooseyboots commented 2 years ago

hi, thx for this v cool project.

i hacked up a tiny interface to the API in emacs, and i'm sorting out issues with it as they come up.

today i tried to send a query that included forward slashes in it. i hexify the request, so the / becomes %2F in my query string, but the request still fails with a 404. i assumed this was me just being incompetent, but i just tried it now using a REST API client, and with curl, and it still fails.

my curl example looks like this

curl -i -XGET https\://translate.igna.rocks/api/v1/en/fr/test\%2Ftest

can you see if i'm doing anything wrong?

thanks for any pointers, and for the package itself again.

thedaviddelta commented 2 years ago

Hi and thanks for your interest in the project.

I've taking a look at the problem and it seems very similar to the #18 we had some months ago, which prevented slashes to correctly encoding on the production front-end but was working correctly if you try it locally (same as this one). This was already solved by opening another issue by myself on the NextJS repo, which I just re-opened with this new problem (the same but with API routes). The issue is linked just above, let's see how much time do they take to reply and what do they tell us.

Regards, David.

mooseyboots commented 2 years ago

hi,

thanks for following this up. hopefully they can resolve it.

mooseyboots commented 2 years ago

@TheDavidDelta i don't suppose you've had any updates on this?

i have run into the issue again, but i'm a little confused as to how my issue differs from #18. maybe it doesn't? but i get 404 errors when i enter a url... (shooting at the API, not the web interface...)

thedaviddelta commented 2 years ago

Hello again! I'm sorry that this problem is still present, but it seems they just ignored my new comment on the previews issue and closed it.

I've just updated the project dependencies to the last Next.js version in order to test it again before creating a new one, and the problem is still there. So I just created a new ticket and linked it to this one again, as you can see!

I hope it catches their attention now. Regards, David.

EsmailELBoBDev2 commented 2 years ago

Oh my god I was about to lose my mind. I thought I'm hunted.

Because I tried to translate and/or and I get 404 page but when I tested it on other instances it was working fine except my instance (this is why I felt haunted) so I think you updated project but not docker image?

thedaviddelta commented 2 years ago

As far as I knew, this was a Vercel problem, and indeed it isn't working in any Vercel-based instance and it is in every other except for yours lol. This is strange but maybe it's because how Next.js manage something that works in a certain way on Vercel and other hosting providers as yours.

Anyway, let the Vercel people on the Next.js team fix this as they did with this same bug on standard routes (#18). By the way, the Docker image is always up-to-date because it's deployed on the CI pipeline.

EsmailELBoBDev2 commented 2 years ago

So we just wait....Yeah I can tell people to not use / in their words till it get fixed

EsmailELBoBDev2 commented 2 years ago

Any updates about my bad luck? image

thedaviddelta commented 2 years ago

Hello again!

I want to give some news about this problem. Originally, I posted about it on the already created issue. Unfortunately, it was ignored and closed.

After that, I opened a new issue describing the problem again. This issue was systematically ignored again, and at the end was closed by the same guy, that just refused to elaborate.

I just don't know what to do to be honest. I'm very upset about this situation. How the previous Vercel guy was amazing in solving the previous similar problem, and how this one is just disregarding it completely.

I think I should just close it, as I can't do anything by myself to solve it. What do you think?

Regards, David.

EsmailELBoBDev2 commented 2 years ago

This is dumb, gimme both links of your issues

thedaviddelta commented 2 years ago

They're both mentioned above, they are vercel/next.js#24775 and vercel/next.js#34776.

EsmailELBoBDev2 commented 2 years ago

@balazsorban44 https://github.com/vercel/next.js/issues/36719

Shatur commented 2 years ago

Have the same issue in my translator with escaped slashes: https://github.com/crow-translate/crow-translate/issues/446. Regular link works, but API link doesn't.

fjrevoredo commented 1 year ago

Hey guys any updates or workarounds for this? Thanks