barryf / vibrancy

Headless CMS and Micropub endpoint for personal websites. Used for the back-end of https://barryfrost.com
MIT License
20 stars 2 forks source link

Slug generation for notes causes (IMO) unnecessary 400s #39

Open jamietanna opened 2 years ago

jamietanna commented 2 years ago
curl localhost:3333/micropub -i -d h=entry -d content='this will become a long slug for the thing'
HTTP/1.1 201 Created
content-type: text/plain; charset=utf-8
location: http://localhost:4444/2021/12/this-will-become-a-long-slug
Date: Thu, 09 Dec 2021 15:21:16 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 0

curl localhost:3333/micropub -i -d h=entry -d content='this will become a long slug for the thing, but has a different content value'
HTTP/1.1 400 Bad Request
content-type: application/json; charset=utf-8
Date: Thu, 09 Dec 2021 15:21:18 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 0

I'd say that in this case, we should then append on a random suffix, or just use a random slug altogether