plone / plone/plone.restapi

Choose valid id if id is provided for content creation

Open
#1,613 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

01 type: bug
Dominant language
Python
Stars
109
Forks
107
Avg merge
2d 3h
Merged PRs (30d)
4

Description

By now content creation, or concrete adding created content to its container, fails, if content with this id provided by the api call already exists in its container.

Steps to reprouce:
POST request to /mypage with id "foo", etc
Another POST request to /mypage with id "foo", etc

The reason, the use case, for this is:
In Volto you can create content, that gets an id that clashes with for example routes that only Volto knows, not the backend. Create a page with title "Register". You are redirected after creation to the register form.
So if in Volto the id is explicitly provided, like for example by appending "-1": "register-1", on REST api call, this would solve the problem, nearly. Do it twice, and it fails, cause plone.restapi does not apply INameChooser(container).chooseName for a call WITH id.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with two POST requests to /mypage using the same explicit id, such as "foo". Trace the content-creation path that handles an explicitly provided id and compare it with the naming behavior for generated ids. Done means repeated creation requests choose a valid non-conflicting id instead of failing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.