404 when resource path in the URL path doesn't exist - #4409
Conversation
The translate view validated the locale, the project and the ProjectLocale, but took the resource straight from the URL. A path that the locale has no resource for rendered the view with the path in the navigation and an empty string list, which reads as an empty resource rather than as a wrong URL. Require the path to name a resource the locale has a TranslatedResource for, unless it is `all-resources` — the same set the paths menu offers. A resource that is obsolete is a 404 too, and so is one belonging to a locale still waiting for its first sync, which has nothing to translate..
There was a problem hiding this comment.
LGTM!!
This doesn't 404 http://localhost:8000/ab/all-projects/foo-i-made-up/also-random.ftl/
because we expect all-projects/all-resources in the slug (and the other case changes the is a different URL anyway) but just curious if that edge case is something we'd want to consider since this is a URL PR.
And only allow "all-resources" as the valid path for "all-projects", because nothing links to a path in that view, and because resource paths are not unique across projects.
Thanks for bringing this up! I fixed it and made all |
Fix #4353.
The translate view validated the locale, the project and the ProjectLocale, but took the resource straight from the URL. A path that the locale has no resource for rendered the view with the path in the navigation and an empty string list, which reads as an empty resource rather than as a wrong URL.
Require the path to name a resource the locale has a TranslatedResource for, unless it is
all-resources— the same set the paths menu offers. A resource that is obsolete is a 404 too, and so is one belonging to a locale still waiting for its first sync, which has nothing to translate..