[xwiki/xwiki-platform] e86f1f: XWIKI-24680: Renaming an attachment without changi...
Branch: refs/heads/backport/stable-18.4.x/pr-6136 Home: https://github.com/xwiki/xwiki-platform Commit: e86f1f46858fab082ec5bf5c30e9451a95d320b3 https://github.com/xwiki/xwiki-platform/commit/e86f1f46858fab082ec5bf5c30e94... Author: Vincent Massol <[email protected]> Date: 2026-08-11 (Tue, 11 Aug 2026) Changed paths: M xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/pom.xml M xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/src/main/java/org/xwiki/attachment/internal/refactoring/job/MoveAttachmentJob.java M xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/src/test/java/org/xwiki/attachment/internal/refactoring/job/MoveAttachmentJobTest.java M xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-test/xwiki-platform-attachment-test-docker/src/test/it/org/xwiki/attachment/test/ui/docker/MoveAttachmentIT.java Log Message: ----------- XWIKI-24680: Renaming an attachment without changing its location deletes the attachment (#6136) * XWIKI-24680: Renaming an attachment without changing its location deletes the attachment * Use a single document instance when the source and the destination of the move are the same document, so that the renamed attachment is added to the instance that is saved instead of to a discarded clone. * Convert MoveAttachmentJobTest to @OldcoreTest so that the job loads, modifies and saves actual XWikiDocument instances through the store, and assert what the job persists rather than which mock it interacts with. * Add a functional test renaming an attachment without changing its location, a case that was only ever covered in combination with a move to another page. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * XWIKI-24680: Renaming an attachment without changing its location deletes the attachment * Restore the assertions on the calls performed by the job that the conversion to @OldcoreTest had dropped: which document is saved with which comment, that the rolled back document is saved with the rollback comment, which document the existing redirection is removed from, and that no document is saved at all when the rights are missing. * Assert that the job leaves the document instance held by the store untouched, which is what the verifications on XWikiDocument#clone() used to cover. * Resolve the document authors with the real user reference components instead of mocking the resolver, since the previous assertion on GuestUserReference held even when no author was set. * Assert the redirection object in the test covering the failure to save the target document. * Perform the rename of the functional test with a different user than the one who uploaded the attachment, and assert that the rename preserves the attachment author, version and history while the document author becomes the user performing the rename. * Assert that the redirection created by the rename is effective and not merely recorded, by downloading the attachment under its old name. * Drop the page reload that immediately followed the creation of the page in the rename test. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> (cherry picked from commit 86fd126316cb0bcbbd9fcd68b43c9e45b4acc533) To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-platform/settings/notifications
participants (1)
-
XWiki Notifications