This issue has been created
There are 3 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-1f73b0f4-39e3-4cc9-ae7f-0165b3bbe95e XWIKI-23008 In Progress

The attachment delete REST endpoint is modifying the cached document

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-4d6fa951-756b-4773-a506-00711f94c47e Thomas Mortagne created this issue on 20/Mar/25 11:20
 
Summary: The attachment delete REST endpoint is modifying the cached document
Issue Type: cid:jira-generated-image-avatar-1f73b0f4-39e3-4cc9-ae7f-0165b3bbe95e Bug
Affects Versions: 16.4.7
Assignee: Unassigned
Components: Old Core, REST
Created: 20/Mar/25 11:20
Priority: cid:jira-generated-image-static-major-a07a9ca3-4b8e-497e-84d7-70dfa6eb2879 Major
Reporter: Thomas Mortagne
Description:

Getting:

java.lang.IllegalStateException: Abusive modification of the cached document 
-    at com.xpn.xwiki.doc.XWikiDocument.setMetaDataDirty(XWikiDocument.java:2436) 
-    at com.xpn.xwiki.internal.doc.XWikiAttachmentList.updateList(XWikiAttachmentList.java:262) 
-    at com.xpn.xwiki.internal.doc.XWikiAttachmentList.remove(XWikiAttachmentList.java:157) 
-    at com.xpn.xwiki.doc.XWikiDocument.removeAttachment(XWikiDocument.java:5611) 
-    at com.xpn.xwiki.doc.XWikiDocument.removeAttachment(XWikiDocument.java:5597) 
-    at org.xwiki.rest.internal.resources.attachments.AttachmentResourceImpl.deleteAttachment(AttachmentResourceImpl.java:118) 

It's also a bit strange to use directly XWikiDocument for this, it should ideally use the public/script API and we usually do in those endpoint so ideally the fix should include adding an API to delete an attachment in api.Document.

 
 

3 updates

 
cid:jira-generated-image-avatar-4d6fa951-756b-4773-a506-00711f94c47e Changes by Thomas Mortagne on 20/Mar/25 11:20
 
Assignee: Thomas Mortagne
Component: Old Core
Status: Open In Progress