[FIX] web_editor: improve comment in loadImageInfo method

The goal of this commit is to improve the comment in the `loadImageInfo`
method.

We decided to retarget [1] to master for a potential merge over there,
although it might just get cancelled entirely. We leave the small
regression in stable: not being possible to customize an image (filter,
optimization, etc) of an image-added-by-url when the URL is actually...
an image in a static folder of your own instance's website. This worked
in the past but this is kinda a weird use case which has alternatives.
Fixing it in stable would be choosing between two possibilities:

- Checking that the URL is actually a "local" URL -> this is exactly
  what we cannot do anymore if we want another bug fix to remain: the
  updated comment explains why.

- Also supporting customizing images added by URL for "external" URL
  -> this is too risky in stable, that is why [1] will be considered in
  master only, although it will not be strictly necessary over there
  since the improvements made with [2].

[1]: https://github.com/odoo/odoo/pull/151858
[2]: https://github.com/odoo/odoo/commit/943944dd249c15de870d6800d89e48d54a422e5a

closes odoo/odoo#153716

X-original-commit: 9d827cc22245a6706d5b6b94ac3c30a3d8cb238b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
Louis (loco)
2024-02-13 10:08:03 +00:00
committed by qsm-odoo
co-authored by qsm-odoo
parent bb541a73dc
commit 8d63e49114
@@ -488,7 +488,13 @@ export async function loadImageInfo(img, rpc, attachmentSrc = '') {
// If src was an absolute "external" URL, we consider unlikely that its
// relative part matches something from the DB and even if it does, nothing
// bad happens, besides using this random image as the original when using
// the options, instead of having no option.
// the options, instead of having no option. Note that we do not want to
// check if the image is local or not here as a previous bug converted some
// local (relative src) images to absolute URL... and that before users had
// setup their website domain. That means they can have an absolute URL that
// looks like "https://mycompany.odoo.com/web/image/123" that leads to a
// "local" image even if the domain name is now "mycompany.be".
//
// The "redirect" check is for when it is a redirect image attachment due to
// an external URL upload.
if (original && original.image_src && !/\/web\/image\/\d+-redirect\//.test(original.image_src)) {