aleph
aleph copied to clipboard
BUG: Error messages in Russian when Accept-Language header is *
Describe the bug
When making an HTTP request to the Aleph API with the Accept-Language header set to * (as seems to be the default in the node.js implementation of fetch()), any error messages will be in Russian.
To Reproduce Assuming Aleph is running on port 8080:
curl -X "POST" "http://localhost:8080/api/2/collections"
# {"status": "error", "message": "You are not authorized to do this.", "roles": [1]}
curl -X "POST" "http://localhost:8080/api/2/collections" -H 'Accept-Language: *'
# {"status": "error", "message": "\u0423 \u0432\u0430\u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u0432.", "roles": [1]}
# (That’s "У вас недостаточно прав." if you don’t speak fluent Unicode)
Expected behavior
Requests with Accept-Language: * should be treated as if the header was not set at all.
(You could argue that the semantics of * are “Any language will do” while a missing header indicates “Give me the default”, but since this is caused by the default behaviour of node.js’s standard library, I imagine I won’t be the only one who is going to find themselves unexpectedly told off in Russian.)
Aleph version 3.15.5