Automattic / Automattic/jetpack

Carousel: error thrown in `originalDimensions` function

Open
#11,191 52 comments 0 reactions 1 assignee Claimed by @sgomes View on GitHub
[Feature] Carousel [Pri] Normal [Status] In Progress Bug Customer Report [LEGACY]
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

#### Steps to reproduce the issue

1. Activate recommended features in Jetpack.
2. Create new post and add a 1) Tiled Gallery and 2) a Gallery block in Gutenberg.
3. Upload these [two](https://unsplash.com/photos/-SFhuMwFClk) [images](https://unsplash.com/photos/hDqLoCCGOdU). Add a long caption to the last one.
4. Publish post and click one of the images to display the carousel.

#### What I expected

- The clicked image to be displayed correctly in the carousel.

#### What happened instead

- Carousel came up empty (both the image, caption, exif data).
- Site is halted and clicks on the carousel don't work because of a JS error.
- Console shows this JS error:

```
Uncaught TypeError: Cannot read property 'split' of undefined
at a.fn.init.originalDimensions (jetpack-carousel.min.js?ver=20190102:4)
at a.fn.init.e.fn.jp_carousel (jetpack-carousel.min.js?ver=20190102:4)
```

![image](https://user-images.githubusercontent.com/390760/51674342-4733ad00-1fc8-11e9-88d3-aa4a4dd552ff.png)

Which seems to originate from the `originalDimensions` function:

https://github.com/Automattic/jetpack/blob/6189a00b72db562d5002b38ae87afce47c717591/modules/carousel/jetpack-carousel.js#L1067

**Screenshots**

![gallery-carousel](https://user-images.githubusercontent.com/390760/51674481-a691bd00-1fc8-11e9-845e-c06b98a955ba.gif)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.