- Install E-commerce app
- Go to Website > Shop, and open a product
- Click on edit on the upper right corner.
- Double click the product image to change it. A popup is shown.
- In the popup, click on Add URL and place this URL [1]
- Click Save. The image disappears!
- The issue was introduced here [2]
- As URL now starts with `/web/image/` which will be later used here [3]
- The condition to enter this line is `url_object.path.startswith('/web/image')`
- `item[field]` is used which equals to `attachment[datas]`
- But actually `datas` is empty as the image upload fails because of CORS
- `add_url` is called [4] saving attachment without `datas` but with type URL
- The commit solves the issue by fetching the remote data from the server
if the url is a remote redirection, which still happens when the image
data cannot be fetched by the client browser at upload time.
[1]: https://lowendbox.com/wp-content/uploads/2022/09/odoo_logo_1200.png
[2]: https://github.com/odoo/odoo/commit/943944dd249c15de870d6800d89e48d54a422e5a#diff-0897c80484208197b0aff67f2b06509e864c3976de1589e3cebad2788eef008fR49
[3]: https://github.com/odoo/odoo/blob/f72968561acec164697a7a9ee0965ec304854dd5/addons/web_editor/models/ir_qweb_fields.py#L473
[4]: https://github.com/odoo/odoo/blob/f72968561acec164697a7a9ee0965ec304854dd5/addons/web_editor/controllers/main.py#L268
opw-3746245
closes odoo/odoo#160085
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>