Skip to content
Snippets Groups Projects
Commit 49a18eec authored by Nasreddin (bon)'s avatar Nasreddin (bon) Committed by Nicolas Lempereur
Browse files

[FIX] website_slides: Traceback when no link provided for video

Issue

	Traceback raised in case no link provided when content type
	is a video.

Solution

	Format url only if provided.

Note: also fix issue with scheme (embedCode src could start with //)

Related fix : https://github.com/odoo/odoo/pull/54536


opw-2294344

closes odoo/odoo#55052

Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
parent 30e3b075
Branches
Tags
No related merge requests found
......@@ -510,10 +510,14 @@ odoo.define('website_slides.fullscreen', function (require) {
slideData.hasNext = index < slidesDataList.length-1;
// compute embed url
if (slideData.type === 'video') {
slideData.embedCode = $(slideData.embedCode).attr('src'); // embedCode containts an iframe tag, where src attribute is the url (youtube or embed document from odoo)
slideData.embedCode = $(slideData.embedCode).attr('src') || ""; // embedCode contains an iframe tag, where src attribute is the url (youtube or embed document from odoo)
var separator = slideData.embedCode.indexOf("?") !== -1 ? "&" : "?";
var autoplay = slideData.embedCode.indexOf("drive.google.com") === -1 ? "&autoplay=1" : "";
slideData.embedUrl = "https://" + slideData.embedCode + separator + "rel=0&enablejsapi=1&origin=" + window.location.origin + autoplay;
var scheme = slideData.embedCode.indexOf('//') === 0 ? 'https:' : '';
var params = { rel: 0, enablejsapi: 1, origin: window.location.origin };
if (slideData.embedCode.indexOf("//drive.google.com") === -1) {
params.autoplay = 1;
}
slideData.embedUrl = slideData.embedCode ? scheme + slideData.embedCode + separator + $.param(params) : "";
} else if (slideData.type === 'infographic') {
slideData.embedUrl = _.str.sprintf('/web/image/slide.slide/%s/image_1024', slideData.id);
} else if (_.contains(['document', 'presentation'], slideData.type)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment