[FIX] web: clear filename if image error
When the user chooses as product image a file which is not an image, the message "Could not display the selected image" is displayed. However, at saving, a traceback is thrown since the file chosen is uploaded anyway. If the image cannot be displayed, the image field is cleared. opw-672206
This commit is contained in:
@@ -1362,6 +1362,7 @@ var FieldBinaryImage = FieldBinary.extend({
|
||||
$img.css("max-height", "" + self.options.size[1] + "px");
|
||||
});
|
||||
$img.on('error', function() {
|
||||
self.on_clear();
|
||||
$img.attr('src', self.placeholder);
|
||||
self.do_warn(_t("Image"), _t("Could not display the selected image."));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user