Lack of checking for duplicate titles/URLs
Opened this issue · 0 comments
I just got paged for WhitehallScheduledPublicationsOverdue where it turned out that a Whitehall scheduled publication had the same title and URL as an existing document on the live website.
It should not be possible to schedule publication of a document with a URL that's already taken by a page on the live website, but it seems we're not adequately validating this when the user creates the draft.
It probably shouldn't even be possible to create a draft with the same name/URL as another page.
At any rate, creating-a-document-with-a-name-clash is a basic error case that we need to be surfacing to the user at the point the mistake is made (i.e. as soon as possible after the user inputs the duplicate name).
Here's what happened in the particular case that I encountered:
Whitehall::UnpublishableInstanceError: URL: http://publishing-api/v2/content/57993145-2d19-46ae-8724-d111b617212d (Whitehall::UnpublishableInstanceError) Response body: {"error":{"code":422,"message":"Base path /government/news/appointment-of-8-court-examiners is already reserved by content-publisher","fields":{"base_path":["/government/news/appointment-of-8-court-examiners is already reserved by content-publisher"]}}}
Whitehall allowed this draft to not only be created with a clashing title but also scheduled for publication.
The document it clashed with is this one in content-publisher.
The two pages (the live one from content-pub and the draft one from whitehall) were identical.