diff --git a/packages/scandipwa/src/component/ProductGallery/ProductGallery.container.js b/packages/scandipwa/src/component/ProductGallery/ProductGallery.container.js index 484e2a3270..14ecfa5432 100644 --- a/packages/scandipwa/src/component/ProductGallery/ProductGallery.container.js +++ b/packages/scandipwa/src/component/ProductGallery/ProductGallery.container.js @@ -175,7 +175,13 @@ export class ProductGalleryContainer extends PureComponent { return acc; }, []).sort((a, b) => a - b); - return positionsArray.findIndex((value) => value === position); + const returnValue = positionsArray.findIndex((value) => value === position); + + if (returnValue === -1) { + return 0; + } + + return returnValue; } getGalleryPictures() { diff --git a/packages/scandipwa/src/component/VideoPopup/VideoPopup.config.js b/packages/scandipwa/src/component/VideoPopup/VideoPopup.config.js index e4f9f8287a..02c91359e1 100644 --- a/packages/scandipwa/src/component/VideoPopup/VideoPopup.config.js +++ b/packages/scandipwa/src/component/VideoPopup/VideoPopup.config.js @@ -18,4 +18,4 @@ export const VIDEO_POPUP_ID = 'VIDEO_POPUP_ID'; * @type {RegExp} */ export const VIMEO_FORMAT = new RegExp('(?:https?//)?vimeo.com[\\w/]*/(\\d+)$'); -export const YOUTUBE_FORMAT = new RegExp('(?:https?//)?www.youtube.com/watch\\?v=(\\w+)'); +export const YOUTUBE_FORMAT = new RegExp('(?:https?//)?www.youtube.com/watch\\?v=([\\w\\-]+)');