When Confluence is deployed under a context path (e.g. https://host/confluence), _get_paged silently constructs a wrong URL for every page after the first, causing the request to hit https://host/rest/api/... instead of https://host/confluence/rest/api/....
Affected version: 5.0.3 (Server/v1 endpoint via ConfluenceBase._get_paged)
Reproduction
Point the client at a Confluence Server instance with a context path:
from atlassian import Confluence
c = Confluence(url="https://host/confluence", username="u", password="p")
list(c.get_page_child_by_type("PAGE_ID_WITH_MORE_THAN_25_CHILDREN"))
The first request goes to https://host/confluence/rest/api/content/{id}/child/page?limit=25&start=0 and succeeds. Confluence returns:
"_links": { "next": "/rest/api/content/{id}/child/page?limit=25&start=25" }
_get_paged then resolves the next URL via:
parsed = urlparse(self.url) # https://host/confluence
site_url = f"{parsed.scheme}://{parsed.netloc}" # https://host ← drops /confluence
url = f"{site_url}/{next_link.lstrip('/')}" # https://host/rest/api/...
The second request hits https://host/rest/api/... (without the context path). The server returns no response / closes the connection, and after retries are exhausted a MaxRetryError / RemoteDisconnected is raised.
Root cause
urlparse(self.url).netloc gives only the host. The context path is in .path and is discarded. The fix for #957 resolved the MissingSchema crash but introduced this regression by using scheme://netloc rather than scheme://netloc/context_path.
Expected behaviour
The next-page URL should be resolved as scheme://netloc/context_path/rest/api/....
Fix
Preserve parsed.path when building site_url:
parsed = urlparse(self.url)
site_url = f"{parsed.scheme}://{parsed.netloc}{parsed.path.rstrip('/')}\u200b"
url = f"{site_url}/{next_link.lstrip('/')}\u200b"
The same class of bug affects the Cloud v2 cursor pagination path and was reported in #1655.
When Confluence is deployed under a context path (e.g.
https://host/confluence),_get_pagedsilently constructs a wrong URL for every page after the first, causing the request to hithttps://host/rest/api/...instead ofhttps://host/confluence/rest/api/....Affected version: 5.0.3 (Server/v1 endpoint via
ConfluenceBase._get_paged)Reproduction
Point the client at a Confluence Server instance with a context path:
The first request goes to
https://host/confluence/rest/api/content/{id}/child/page?limit=25&start=0and succeeds. Confluence returns:_get_pagedthen resolves the next URL via:The second request hits
https://host/rest/api/...(without the context path). The server returns no response / closes the connection, and after retries are exhausted aMaxRetryError/RemoteDisconnectedis raised.Root cause
urlparse(self.url).netlocgives only the host. The context path is in.pathand is discarded. The fix for #957 resolved theMissingSchemacrash but introduced this regression by usingscheme://netlocrather thanscheme://netloc/context_path.Expected behaviour
The next-page URL should be resolved as
scheme://netloc/context_path/rest/api/....Fix
Preserve
parsed.pathwhen buildingsite_url:The same class of bug affects the Cloud v2 cursor pagination path and was reported in #1655.