pokeapi icon indicating copy to clipboard operation
pokeapi copied to clipboard

Languages with hyphenated names can't be retrieved by name

Open desophos opened this issue 3 months ago • 4 comments

Languages with a name key whose value contains a hyphen return a 404 Not Found response. This can be observed with language 1, ja-Hrkt, for example. I've checked other languages as well and tried variations on the name with no success.

Current behavior: the URL https://pokeapi.co/api/v2/language/ja-Hrkt returns a payload of "Not Found", status 404

Expected behavior: the response is the same as https://pokeapi.co/api/v2/language/1

Steps to Reproduce:

Navigate to https://pokeapi.co/api/v2/language/ja-Hrkt.

desophos avatar Sep 06 '25 02:09 desophos

@Naramsim I started to look into this, but found that I cannot replicate the issue locally with the current master branch? Are the latest changes not deployed?

When setting things up locally (using the non-Docker instructions at least), navigating to http://127.0.0.1:8000/api/v2/language/ja-Hrkt/ seems to produce the expected result?

{"id":1,"name":"ja-Hrkt","official":true,"iso639":"ja","iso3166":"jp","names":[{"name":"日本語","language":{"name":"ja-Hrkt","url":"http://127.0.0.1:8000/api/v2/language/1/"}},{"name":"일본어","language":{"name":"ko","url":"http://127.0.0.1:8000/api/v2/language/3/"}},{"name":"Japonais","language":{"name":"fr","url":"http://127.0.0.1:8000/api/v2/language/5/"}},{"name":"Japanisch","language":{"name":"de","url":"http://127.0.0.1:8000/api/v2/language/6/"}},{"name":"Japonés","language":{"name":"es","url":"http://127.0.0.1:8000/api/v2/language/7/"}},{"name":"Japanese","language":{"name":"en","url":"http://127.0.0.1:8000/api/v2/language/9/"}}]}

jonbarrow avatar Sep 14 '25 01:09 jonbarrow

We don't use the Django server in production, we convert the entire API to static JSONs and serve them through a GCP function. Maybe the issue is somewhere else.

Naramsim avatar Sep 14 '25 08:09 Naramsim

I see. Is that process public or documented anywhere? I'm poking around this repo atm and can't seem to find where that happens. Production not matching what's in the repo definitely makes finding these sorts of issues harder

jonbarrow avatar Sep 14 '25 16:09 jonbarrow

Everything is public and open source. You can read the website to find out how we deploy. On the 'about' page. There are other repos. The ones you need are api-data and deploy

Naramsim avatar Sep 14 '25 23:09 Naramsim