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

Accessing mapped language URLs results in Error '404' in some cases #5665

Closed
1 task done
luebbe opened this issue Mar 15, 2021 · 3 comments
Closed
1 task done

Accessing mapped language URLs results in Error '404' in some cases #5665

luebbe opened this issue Mar 15, 2021 · 3 comments

Comments

@luebbe
Copy link
Contributor

luebbe commented Mar 15, 2021

Weblate doesn't map language codes consistently across all URLs and returns a 404 error in some cases. Maybe an API issue. The web UI seems to behave as expected.

I already tried

Describe the steps you tried to solve the problem yourself.

  • I've read and searched the docs and did not find the answer there.
    If you didn’t try already, try to search there what you wrote above.

To Reproduce the issue

Steps to reproduce the behavior:

  1. Access: https://<weblate>/languages/zh_CN/.
    This is mapped to https://<weblate>/languages/zh_Hans/ as expected.
  2. POST a translation file to https://<weblate>/api/translations/<project>/<component>/zh_CN/file/.
    This results in an error 404 'Not Found' JSON: {"detail":"Not found."} response.

This is the case that I came across. There may be more. Maybe the API bypasses the language code mapping?
The web UI always switches from zh_CN URLs to zh_Hans in the cases that I have tried.

Expected behavior

That in all cases zh_CN is mapped to zh_Hans without an error.

Screenshots

Exception traceback

Server configuration and status

Weblate installation: Docker

Weblate deploy checks

Additional context

@nijel
Copy link
Member

nijel commented Mar 15, 2021

There is no mapping in the API and I don't think there should be one - it would be broken for non-GET (POST/PATCH/DELETE) requests anyway. Such request would be consumed by the redirect and the correct location would be served as GET. #4798 is an example of such behaviour (though it has different cause there).

For the UI part we only redirect GET requests as that is what most people do - click on a link which is no longer valid (after renaming project/component or merging languages).

@luebbe
Copy link
Contributor Author

luebbe commented Mar 15, 2021

Sound logical. If this is intended behaviour, I'm fine with it. It's no problem to handle the mapping on the client side. I just had to know that it should be done this way.

@luebbe luebbe closed this as completed Mar 15, 2021
@github-actions
Copy link

The issue you have reported is resolved now. If you don’t feel it’s right, please follow it’s labels to get a clue and take further steps.

  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

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

2 participants