cjdenio / shorty

High-performance link shortener

Home Page:https://clb.li

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`PATCH` can still create links with empty name

lilyball opened this issue · comments

If I create a link, and then send a PATCH with { "name": "" }, shorty will happily change the name to be empty, thus preventing it from ever being referenced again (including being destroyed). See #11.

For comparison, PATCH with { "name": null } behaves as though the "name" key weren't present. Though treating "name": "" as though it weren't present at all may be a bit surprising.

I think the right behavior here is to treat PATCH with { "name": "" } as an error. Having that (or "name": null) randomize the name might be surprising.