anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
231 stars 73 forks source link

Update to ensure book slugs are always unique #123

Closed arthurian closed 4 years ago

arthurian commented 4 years ago

This PR adds database constraints that guarantee no two books can have the same slug, and updates the application logic for checking slugs and handling duplicate key errors (e.g. trying to insert a record that violates a unique constraint).

We encountered this issue while using S3 file storage. Even though this issue will probably not affect installations using the filesystem-based storage, these updates should guarantee they don't.

Here's a complete rundown of the changes included in the PR.

Database Changes

Code Changes

Addendums

Thoughts, questions, concerns?

craigdietrich commented 4 years ago

Fantastic!