Wp-calypso: Media: Galleries without `id` not well handled

Created on 17 Apr 2017  路  3Comments  路  Source: Automattic/wp-calypso

Steps to reproduce

  1. Starting at URL: https://wordpress.com/post
  2. Select a site
  3. Switch to HTML tab
  4. Insert [gallery link="file" orderby="rand"] (or other gallery shortcode without id attribute)
  5. Switch to Visual tab
  6. Select gallery
  7. Click Edit

What I expected

To edit gallery items.

What happened instead

Nothing, and an error in the console.

Uncaught TypeError: Cannot read property 'split' of undefined

Browser / OS version

Chrome Version 57.0.2987.133 (64-bit)
macOS Sierra 10.12.4 (16E195)

Context / Source

See core logic for deciding media to include for shortcodes without id attribute assigned:

https://github.com/WordPress/WordPress/blob/9ff1301/wp-includes/media.php#L1682-L1699

It's unlikely this error will occur with user flows in Calypso exclusively, unless the user manually edits the shortcode themselves, as all inserted galleries in Calypso will assign an id attribute.

p47NkD-Cj-p2

Editor Media [Status] Stale [Type] Bug

Most helpful comment

Hi @mknepprath , thanks for taking this on! To submit a pull request, you'll need to push your branch to your own personal fork of the wp-calypso repository, then return here to submit a pull request. The GitHub interface is usually quite good about highlighting the branch from your fork.

If you're having trouble with this, feel free to reach out to me as aduth on the WordPress community Slack:

https://make.wordpress.org/chat/

All 3 comments

@apeatling @youknowriad Hi! I have a fix for this locally, but am having trouble getting a branch pushed so I can create a PR (#13326). Would love a hand, thanks!

Hi @mknepprath , thanks for taking this on! To submit a pull request, you'll need to push your branch to your own personal fork of the wp-calypso repository, then return here to submit a pull request. The GitHub interface is usually quite good about highlighting the branch from your fork.

If you're having trouble with this, feel free to reach out to me as aduth on the WordPress community Slack:

https://make.wordpress.org/chat/

This issue has been marked as stale because it hasn't been updated in a while. It will be closed in a week. If you would like it to remain open, can you please comment below and see what you can do to get things moving with this issue? Thanks! 馃檹

Was this page helpful?
0 / 5 - 0 ratings