Problem/Motivation

The attachments request in getAttachmentsList() sends no _limit/pagination, so the API's default page size of 30 items applies.

The OpenWoo API paginates its attachments endpoint, and the module only ever reads the first page.

What the API returns for /publications/c16a6026-…/attachments:

┌───────────────────────────────┬───────┬───────┬───────┬──────────┐
│            Request            │ total │ limit │ pages │ returned │
├───────────────────────────────┼───────┼───────┼───────┼──────────┤
│ no params (what Drupal sends) │ 116   │ 30    │ 4     │ 30       │
├───────────────────────────────┼───────┼───────┼───────┼──────────┤
│ ?_limit=200                   │ 116   │ 200   │ 1     │ 116      │
├───────────────────────────────┼───────┼───────┼───────┼──────────┤
│ ?_page=2                      │ 116   │ 30    │ 4     │ 30       │
└───────────────────────────────┴───────┴───────┴───────┴──────────┘

So there are 116 attachments, but the API returns 30 per page unless you ask for more.

Proposed resolution

Fix: go through all pages instead of reading only the first. The /publications endpoint uses _limit/_offset

Issue fork openwoo-3629080

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joshahubbers created an issue. See original summary.

joshahubbers’s picture

Status: Needs review » Fixed

Reviewed by @RalphvdHout

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • joshahubbers committed 42ada0fc on 1.0.x
    fix: #3629080 Only the first 30 attachments are shown
    
    By: joshahubbers...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.