[FIX] base_import: prevent trackback while upload unidentified image URL
This issue occurs when a customer imports or uploads a file, and that file
contains an image that is attached to the URL as text or HTML. then,
The error would be generated.
Step to Produce:-
- import CSV file (Ex.'product.product' model)
> that CSV file must have one URL Image(In that URL has content of text or
Html form)
- Click On the 'Test' Button.
Applying these changes will resolve this issue.
sentry:-4046190590
closes odoo/odoo#137611
X-original-commit: acbb5af7ee96cdc579850427bc2bca6d7bf184e4
Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
This commit is contained in:
@@ -1263,14 +1263,13 @@ class Import(models.TransientModel):
|
||||
|
||||
return base64.b64encode(content)
|
||||
except Exception as e:
|
||||
_logger.exception(e)
|
||||
raise ImportValidationError(
|
||||
_(
|
||||
"Could not retrieve URL: %(url)s [%(field_name)s: L%(line_number)d]: %(error)s",
|
||||
url=url, field_name=field, line_number=line_number + 1, error=e
|
||||
),
|
||||
field=field
|
||||
)
|
||||
_logger.warning(e, exc_info=True)
|
||||
raise ValueError(_("Could not retrieve URL: %(url)s [%(field_name)s: L%(line_number)d]: %(error)s") % {
|
||||
'url': url,
|
||||
'field_name': field,
|
||||
'line_number': line_number + 1,
|
||||
'error': e
|
||||
})
|
||||
|
||||
def execute_import(self, fields, columns, options, dryrun=False):
|
||||
""" Actual execution of the import
|
||||
|
||||
Reference in New Issue
Block a user