You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
attach_content() may miss existing attachments #1700
Hi, while comparing 4.0.7 and 5.0.5 I noticed a change in how attach_content() checks if a file is already attached. I haven't reproduced it yet, but I'm worried it could cause problems.
In 4.0.7 the file name is sent as a filter, so Confluence returns only the matching attachment (L1594):
In 5.0.5 there is no filter, and the file is searched only in the first batch of results (L1429):
attachments=self.get(path=path, headers=headers)
If a page has many attachments, I think the existing file might not be in that first batch. In that case I'd expect:
The existing file is not found.
attach_content() tries to create it as a new attachment (POST).
Confluence rejects it, because a file with that name already exists.
This seems to have come in with #1666 (5.0.4), which fixed the PUT problem from #1660. The fix itself looks good, only the filename filter from 4.0.7 seems to have been dropped along the way.
Suggestion:
Add params={"filename": name} back to that request, like in 4.0.7.
Activity