summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2020-10-07 14:01:32 +0000
committerqsm-odoo <qsm@odoo.com>2020-10-07 14:22:17 +0000
commit9c2d02f6e78a01eca02de90dd9406effa0308d27 (patch)
treef1e2f84593cb2d03bc6922d37eb804fd47004a0a
parent1cde9f5fde19f8dba3a9720bc9eb71b7a74c4d72 (diff)
[FIX] web_editor: restore adding bg video in some context
Since [1] the feature was broken because of a traceback which occured while trying parse a background image URL of an element which is not in the DOM. [1]: https://github.com/odoo/odoo/commit/7558dcce791f707e3f3470835133f91ec7ff074f closes odoo/odoo#59425 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
-rw-r--r--addons/web_editor/static/src/js/common/utils.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/common/utils.js b/addons/web_editor/static/src/js/common/utils.js
index 8beeca4f26e..b4ffdc4b3af 100644
--- a/addons/web_editor/static/src/js/common/utils.js
+++ b/addons/web_editor/static/src/js/common/utils.js
@@ -224,12 +224,13 @@ function _getBgImageURL(el) {
if (!match) {
return '';
}
- const fullURL = new URL(match[2]);
+ const matchedURL = match[2];
// Make URL relative if possible
+ const fullURL = new URL(matchedURL, window.location.origin);
if (fullURL.origin === window.location.origin) {
return fullURL.href.slice(fullURL.origin.length);
}
- return match[2];
+ return matchedURL;
}
return {