Item13895: rest/ImagePlugin/resize returns corrupt data
Priority: Urgent
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: ImagePlugin
Branches: master
SolrPlugin includes nice image preview on the result page.
The images get fetched via
/bin/rest/ImagePlugin/resize?....
.
In Foswiki 2.0.3, ISO Store, we observer now, that the jpg previews data gets wrongly utf encoded.
I don't know, whether this is a bug of the Plugin or a shortcoming of the Rest API in core.
--
AndreLichtsteiner - 14 Dec 2015
It's a bug in the plugin. binary data should be output using
response->body()
text with
response->print()
Thanks CDot for the reminder. Try the following patch (not tested)
diff --git a/lib/Foswiki/Plugins/ImagePlugin/Core.pm b/lib/Foswiki/Plugins/ImagePlugin/Core.pm
index 36b3308..0653f13 100644
--- a/lib/Foswiki/Plugins/ImagePlugin/Core.pm
+++ b/lib/Foswiki/Plugins/ImagePlugin/Core.pm
@@ -169,7 +169,7 @@ sub handleREST {
);
my $image = readImage($imgWeb, $imgTopic, $imgInfo);
- $response->print($image);
+ $response->body($image);
}
return;
MichaelDaum, can you review this. Plugin is CoordinateWithAuthor See
TestItem13895 for a demonstration.
--
GeorgeClark - 14 Dec 2015
Thanks for the patch. I will add it to the next release. I didn't realize the error before as I use
XSendFileContrib to deliver attachments and thumbnails for better performance.
--
MichaelDaum - 15 Dec 2015
Yeah, patch works fine.
--
Main.AndreLichtsteiner - 21 Dec 2015 - 09:54