driebit / ginger

Ginger: awesome semantic CMS built on Zotonic
http://ginger.nl
Apache License 2.0
29 stars 9 forks source link

[base] resource_exists in REST api doesn't return 404 but 500 #566

Closed rl-king closed 5 years ago

rl-king commented 5 years ago

Calling /data/resources/:id with a non existing id returns a 500 instead of 404.

https://github.com/driebit/ginger/blob/master/modules/mod_ginger_base/controllers/controller_rest_resources.erl#L60

ddeboer commented 5 years ago

This may be caused by controller_rest accepting a map instead of a list for State. Webzmachine doesn’t handle a map argument correctly.

rl-king commented 5 years ago

Ah thanks, interesting. Quite a refactor to change that as well.

rl-king commented 5 years ago

As suggested, replacing maps with proplists in the dispatch rules fixes this issue