I’m developing a plugin to replace existing Confluence attachment files with new content. The new files are tagged with security-related metadata, so we want to change the data for all available versions rather than create a new version, to avoid having the untagged files on the server at all. I can replace the files in the attachments folder, but they can’t be downloaded from Confluence because they have an inaccurate filesize value in the ContentProperties table.
Is there a way to update the filesize in ContentProperties without resorting to executing SQL statements? In a Jira plugin for the same purpose, I was able to use OfBizDelegator to update the filesize in the FileAttachment table, but I haven’t found a similar approach for Confluence. I did find ContentPropertiesService and was able to set properties with that, but they were custom properties stored in the Content table and I wasn’t able to update anything in the ContentProperties table. Active Objects appears to only offer such an interface for new custom objects in the plugin’s storage, not internal objects like attachments. Alternatively, is there a better way to replace an attachment’s data such that the filesize updates itself?