Skip to content

Commit

Permalink
Fix EZP-21358: ezjscAjaxContent: Image's exif fields MakerNote and Us…
Browse files Browse the repository at this point in the history
…erComment must be base64 encoded

ezjscAjaxContent now returns image's exif fields MakerNote and UserComment base64 encoded.
  • Loading branch information
yannickroger committed Aug 6, 2013
1 parent 1a5ea60 commit a01bc57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/bc/5.2/changes-5.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ Change of behavior
mechanism. Autoload generator add these clasess to the autoload array, so there's no
need to do any of the file_exists or include calls.

- Fix EZP-21358: ezjscAjaxContent: Image's exif fields MakerNote and UserComment must be base64 encoded

ezjscAjaxContent now returns image's exif fields MakerNote and UserComment base64 encoded.


Removed features
----------------
Expand Down
10 changes: 9 additions & 1 deletion extension/ezjscore/classes/ezjscajaxcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,18 @@ public static function simplify( $obj, $params = array() )
$imageArray,
function ( &$element, $key )
{
// These fields can contain non utf-8 content
// badly handled by mb_check_encoding
// so they are just encoded in base64
// see https://jira.ez.no/browse/EZP-21358
if ( $key == "MakerNote" || $key == "UserComment")
{
$element = base64_encode( (string)$element );
}
// json_encode/xmlEncode need UTF8 encoded strings
// (exif) metadata might not be for instance
// see https://jira.ez.no/browse/EZP-19929
if ( !mb_check_encoding( $element, 'UTF-8' ) )
else if ( !mb_check_encoding( $element, 'UTF-8' ) )
{
$element = mb_convert_encoding(
(string)$element, 'UTF-8'
Expand Down

0 comments on commit a01bc57

Please sign in to comment.