Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.0 B1
-
None
Description
There is a problem with DownloadRev and ImagePlugin. The cache seems to store a wrong version.
To reproduce
1/ Upload an image called test.jpg
2/ Update with a different image called also test.jpg
3/ View history
Both images will be the same in the thumbnail
If you remove the width parameters from the downloadrev url you will get the right image. This proves the problem is in the cache
The following code in com.xpn.xwiki.plugin.image.ImagePlugin
public XWikiAttachment downloadAttachment(XWikiAttachment attachment, XWikiContext context) {
int height = 0;
int width = 0;
XWikiAttachment attachmentClone = null;
try {
String sheight = context.getRequest().getParameter("height");
String swidth = context.getRequest().getParameter("width");
if (sheight!=null)
height = Integer.parseInt(sheight);
if (swidth!=null)
width = Integer.parseInt(swidth);
attachmentClone = (XWikiAttachment) attachment.clone();
String key = attachmentClone.getId() + "" + attachmentClone.getVersion() + "" + TYPE_PNG + "" + width + "" + height;
Calculates the "key" of the cache. The version is included, so there should be no overlap.
I suspect the version is wrong in the attachementClone object which leads the key to be the same for each version