Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request scandipwa#4939 from lucas-langa/product-gallery
Browse files Browse the repository at this point in the history
fix yt videos with hyphens, set base image position to a valid one
  • Loading branch information
carinadues authored Jun 23, 2022
2 parents 2e51123 + 2ac6ce0 commit 110996e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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\\-]+)');

0 comments on commit 110996e

Please sign in to comment.