huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
242 stars 80 forks source link

Wrong URL tosses a 500 instead of a 400 #6872

Open txau opened 5 months ago

txau commented 5 months ago

This kind of request should be handled as a BAD REQUEST (400), instead it is a 500. Alternatively, it could be handled as a 301 (MOVED PERMANENTLY).

url: //
TypeError: Invalid URL
    at new URL (node:internal/url:775:36)
    at createFetchRequest (/opt/uwazi/cores/core-1.169.1/app/react/entry-server.js:68:15)
    at getSSRProperties (/opt/uwazi/cores/core-1.169.1/app/react/entry-server.js:245:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async EntryServer (/opt/uwazi/cores/core-1.169.1/app/react/entry-server.js:276:70)
    at async /opt/uwazi/cores/core-1.169.1/app/api/utils/routesErrorHandler.js:7:5
original error: {
 "code": "ERR_INVALID_URL",
 "input": "//",
txau commented 2 weeks ago

Changing priority since this is a typical error in our logs generating noise.