plone / plone/plone.restapi

Collection's @id is wrong when summarized as a child

Open
#837 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

How to replicate:

  • Go to https://volto.kitconcept.com/
  • Create a folder, add a collection inside
  • In the folder, as part of that folder's listing, the collection URL is wrong, it's the same as the folder's.

The issue seems to be related to this code: https://github.com/plone/plone.restapi/blob/master/src/plone/restapi/serializer/collection.py#L21

        batch = HypermediaBatch(self.request, results)

        results = collection_metadata
        if not self.request.form.get("fullobjects"):
            results["@id"] = batch.canonical_url

The HypermediaBatch batch object uses the wrong "root".

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

Start in src/plone/restapi/serializer/collection.py around the HypermediaBatch construction and compare its canonical URL when a collection is listed as a child. Reproduce the folder-and-collection scenario from the issue, then verify that the child collection's summarized @id is its own URL rather than the parent folder's URL.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.