odoo/odoo#163687

Created by fw-bot
label
odoo-dev:saas-17.2-17.0-fix-forward-port-not-use-image-on-document-upload-loco-lX11-fw
head
94bded751e076daa00907d95b95a4f23c18d779c
target
saas-17.2
merged
3 weeks ago by Website, Colin Louis (loco)
forward-port of
odoo/odoo#163576

[FW][FIX] web_editor: do not use image when uploading document from URL

The goal of this commit is to forward port [the original commit] which was introduced in 16.4 but, due to an error, has not been forward ported.

Original commit message:
Since [1] when uploading images from URL the data is downloaded and then hosted on the Odoo instance. As stated in its task (task-3129360) it should not have been applied to document URLs.
Because of this, when hitting a CORS issue to fetch binary data, we try to fetch the data through an `<img>` element by setting its `src` field
- which also fails when the data is not an image.

This commit makes the changes of [1] specific to image uploads and restores the previous behavior for other files.

Steps to reproduce:
- Drop a "Text - Image" snippet.
- Double-click on the image.
- Go to the Documents tab.
- Click on "Add URL".
- Enter an example PDF URL. E.g.: https://www.africau.edu/images/default/sample.pdf
- Click on "Add URL".

=> Fails because of a CORS issue.

[the original commit]: https://github.com/odoo/odoo/commit/238566d1dea29fd11353e7e6529d29843c4f658b
[1]: https://github.com/odoo/odoo/commit/943944dd249c15de870d6800d89e48d54a422e5a

task-3493618

Forward-Port-Of: odoo/odoo#163576