volto icon indicating copy to clipboard operation
volto copied to clipboard

Cannot create a page with short name "contributors"

Open iFlameing opened this issue 2 years ago • 2 comments

If I name the page contributors then I am unable to save.

iFlameing avatar Jun 17 '22 13:06 iFlameing

I am new to Volto @iFlameing can you please specify the issue

harshit-dugar avatar Jun 17 '22 16:06 harshit-dugar

@harshit-dugar Try to give a page Title contributors you will be not able to solve the page.

iFlameing avatar Jun 21 '22 12:06 iFlameing

We need to create a static list in Volto with reserved words (e.g. "contributors", "search") and make sure the Volto UI tells editors when they want to add or edit an ID that matches our reserved words list.

@robgietema @sneridagh if I am not mistaken we worked on something like this in one of our client projects.

tisto avatar Oct 26 '23 06:10 tisto

We need to create a static list in Volto with reserved words (e.g. "contributors", "search") and make sure the Volto UI tells editors when they want to add or edit an ID that matches our reserved words list.

I think this should be done on the backend level and emit a proper error through the REST API when creating a content with such URLs

erral avatar Oct 26 '23 08:10 erral

@tisto we already do it in the widget ID in core (see below), but in the use case of "add" form, the main check happens on the backend, on POST. As @erral hinted the RESTAPI response should be more explicit in the case of clash. Could be that the error provided in Dexterity won't be enough descriptive even... so it might require more changes than fixing only RESTAPI.

/cc @davisagli @jaroel

Using a static list of reserved words, in the config:

https://github.com/plone/volto/blob/main/src/components/manage/Widgets/IdWidget.jsx#L101

Checking the current list of indexes:

https://github.com/plone/volto/blob/main/src/components/manage/Widgets/IdWidget.jsx#L147-L149

And checking for special characters:

https://github.com/plone/volto/blob/main/src/components/manage/Widgets/IdWidget.jsx#L142-L145C6

sneridagh avatar Oct 26 '23 08:10 sneridagh

As @erral hinted the RESTAPI response should be more explicit in the case of clash. Could be that the error provided in Dexterity won't be enough descriptive even... so it might require more changes than fixing only RESTAPI.

/cc @davisagli @jaroel

I think we don't even have such a list in the backend... I tried once to track down how was this controlled on Plone or Zope level (because a client added a page named layout in Plone 3 and when we migrated it to Plone 5 it crashed) and I wasn¡t able to track it down.

erral avatar Oct 26 '23 11:10 erral

This is related to https://github.com/plone/plone.restapi/issues/1613

davisagli avatar Oct 28 '23 21:10 davisagli

Also related to https://github.com/plone/volto/issues/3716 and https://github.com/plone/volto/pull/4686#discussion_r1322684331

davisagli avatar Oct 28 '23 22:10 davisagli