zazuko / trifid

Lightweight Linked Data Server and Proxy
Apache License 2.0
77 stars 10 forks source link

Content negotiation does not work if it's a list #362

Closed ktk closed 2 months ago

ktk commented 2 months ago

It looks like content-neg with a list of options is broken at the moment. For example:

curl 'https://agriculture.ld.admin.ch/foag/product-group/8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: text/turtle' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://cube-viewer.zazuko.com/' -H 'Origin: https://cube-viewer.zazuko.com' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Priority: u=1'

works & returns as expected Turtle. But this:

curl 'https://agriculture.ld.admin.ch/foag/product-group/8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:126.0) Gecko/20100101 Firefox/126.0' -H 'Accept: application/ld+json, application/trig, application/n-quads, application/n-triples, text/n3, text/turtle, application/rdf+xml' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: https://cube-viewer.zazuko.com/' -H 'Origin: https://cube-viewer.zazuko.com' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Priority: u=1'

in other words it does not properly parse 'Accept: application/ld+json, application/trig, application/n-quads, application/n-triples, text/n3, text/turtle, application/rdf+xml'. Remember that they could also have q-values, like the Accept-Language header.

I remember we used a JS lib that took care of that, could it be that this got removed with the refactor? It might have been this one.

ludovicm67 commented 2 months ago

Thanks for the bug report. This has been fixed and released in Trifid v5.0.3 :)