Skip to content

fix: fetch every attachment of a page when downloading images - #35

Merged
blaipr merged 1 commit into
mainfrom
fix/page-attachments
Sep 2, 2026
Merged

blaipr merged 1 commit into
mainfrom
fix/page-attachments

Conversation

@blaipr

@blaipr blaipr commented Sep 2, 2026

Copy link
Copy Markdown
Member

Problem

download_page fetched a page's attachments with a single get_attachments_from_content(page_id, limit=250) call. Confluence Cloud caps that endpoint's page size well below 250 and signals the remainder only through _links.next, which was never followed. On a page with more attachments than one server page, every image referencing an attachment past the cap was reported as attachment not found on page and skipped, leaving a dangling image link in the Markdown.

Change

A new get_page_attachments(client, page_id) fetches the list page by page, mirroring get_child_pages: it follows _links.next when the response is a dict (and pages by count when an older client returns a plain list), advancing start by the number of results actually returned so a server-applied smaller page size is handled. download_page builds its title lookup from the full list.

Compatibility

Download only. Pages with few attachments behave as before (one request); pages with many now download all their referenced images.

Checklist

  • ruff check src tests, ruff format --check src tests and python -m pytest tests/ pass
  • Tests added for the change (tests/test_attachments.py)
  • Docs updated — not needed, no user-facing behaviour described in the docs changes
  • docs/conversion.md — not needed, no equivalence changed
  • CHANGELOG.md updated under Unreleased

@blaipr
blaipr force-pushed the fix/page-attachments branch from 4b01eb1 to f4c8113 Compare September 2, 2026 22:39
@blaipr
blaipr merged commit 714ea4f into main Sep 2, 2026
1 check passed
@blaipr
blaipr deleted the fix/page-attachments branch September 2, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant