There are 6 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-4c1f1f12-64e1-4283-ade9-3008f49eebda XWIKI-4326 Closed

When given a name of a target document which already exists, XWikiDocument.rename refactors links and deletes original

 
View issue   ยท   Add comment
 

6 updates

 
cid:jira-generated-image-avatar-d0b21f58-71e5-4297-872b-99e45b20ac5f Changes by Simon Urli on 19/Nov/26 09:29
 
Documentation in Release Notes: N/A
Documentation: N/A
Assignee: Simon Urli
Resolution: Won't Fix
Status: Open Closed
Labels: bugfixingday
 
 

1 comment

 
cid:jira-generated-image-avatar-d0b21f58-71e5-4297-872b-99e45b20ac5f Simon Urli on 19/Nov/26 09:29
 

This is still true on master, but only for the legacy API, so closing as Won't Fix.

  • The supported rename path, XWiki#renameDocument(DocumentReference, DocumentReference, boolean, List, List, XWikiContext) (used by the Refactoring module and by the deprecated script API Document#rename), is not affected: when the target exists it does nothing unless overwrite is true, in which case the target is deleted first. The move is an atomic store rename (XWikiStoreInterface#renameXWikiDoc), not a copy + delete, and links are only refactored after it succeeded.
  • The problem remains in XWikiDocument#rename(...), which now only lives in xwiki-platform-legacy-oldcore (deprecated since 2.2M2 / 12.5RC1). It calls XWiki#renameByCopyAndDelete, which still ignores the false returned by copyDocument when the target exists, then refactors the links and deletes the source. Nothing in xwiki-platform calls it anymore.

Code still using XWikiDocument#rename should move to XWiki#renameDocument or to the Refactoring script service.

PS: This post was co-written with Claude Code.