When setting photo JSON, wrap the json serialization in an eval to trap errors. Addresses bug #12002.

This commit is contained in:
Colin Kuskie 2011-01-10 13:24:29 -08:00
parent a96a9c3989
commit a0119e9e82
2 changed files with 11 additions and 6 deletions

View file

@ -27,6 +27,7 @@
- fixed #11976: Use Container URL in search gives user Permission Denied
- fixed #11985: Search.pl should warn on bad assets
- fixed #12008: Activity CleanLoginHistory is too slow
- fixed #12002: Errors parsing JSON for EXIF in Gallery
7.10.6
- fixed #11974: Toolbar icons unclickable in Webkit using HTML5

View file

@ -549,13 +549,17 @@ sub updateExifDataFromFile {
}
# Remove other, pointless, possibly harmful keys
for my $key ( qw( Directory NativeDigest CameraID CameraType ) ) {
delete $info->{ $key };
}
delete @{ $info }{qw( Directory NativeDigest CameraID CameraType )};
$self->update({
exifData => to_json( $info ),
});
my $json = eval { to_json ($info) };
if ($@) {
$self->session->log->warn('Bad EXIF data in image file for Photo asset '. $self->getId .', unable to convert to JSON');
}
else {
$self->update({
exifData => $json,
});
}
}
#----------------------------------------------------------------------------