Skip to content

Commit

Permalink
[FIX] web_editor: improve comment in loadImageInfo method
Browse files Browse the repository at this point in the history
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]: odoo#151858
[2]: odoo@943944d

closes odoo#153438

Signed-off-by: Quentin Smetz (qsm) <[email protected]>
Co-authored-by: qsm-odoo <[email protected]>
  • Loading branch information
loco-odoo and qsm-odoo committed Feb 9, 2024
1 parent 27eb39e commit 402f063
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addons/web_editor/static/src/js/editor/image_processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,12 @@ 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".
if (original && original.image_src) {
img.dataset.originalId = original.id;
img.dataset.originalSrc = original.image_src;
Expand Down

0 comments on commit 402f063

Please sign in to comment.