Closing as duplicate of XWIKI-22784 (the image/attachment case and the root cause analysis have been copied there).