WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#42760 reviewing defect (bug)

Trying to access an attachment directly by URL not working

Reported by: ppetrov2c Owned by: adamsilverstein
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.1
Component: Media Keywords:
Focuses: javascript Cc:
PR Number:

Description

For example the URL https://example.com/wp-admin/upload.php?item=14
If there are more than 40 attachments, trying to access any attachment page after that 40th entry, will result in a JS error:

Uncaught TypeError: Cannot read property 'set' of undefined

Trying to open any attachment page via URL before and including 40, will work as expected.

A quick look, and it appears that, the problem comes from media-grid JS.

item = library.findWhere( { id: parseInt( query, 10 ) } );

The line above will return undefined, resulting in the attachment page not showing.

I'm attaching a screenshot with a log of the library variable from the media-grid JS file (line 521).

https://i.imgur.com/euFKa0p.png

Change History (3)

#1 follow-up: @adamsilverstein
2 years ago

  • Owner set to adamsilverstein
  • Status changed from new to reviewing

@ppetrov2c Thanks for the bug report and welcome to WordPress trac!

Testing locally I was not able to reproduce this issue. Can you please try disabling all plugins and also switching to one of the default themes (twentyseventeen for example) to see if the problem persists?

#2 @adamsilverstein
2 years ago

  • Focuses javascript added

#3 in reply to: ↑ 1 @ppetrov2c
2 years ago

Replying to adamsilverstein:

@ppetrov2c Thanks for the bug report and welcome to WordPress trac!

Testing locally I was not able to reproduce this issue. Can you please try disabling all plugins and also switching to one of the default themes (twentyseventeen for example) to see if the problem persists?

Forgot to mention, sorry about that - I did the tests on vanilla WordPress 4.9.1, without plugins and the twentyseventeen theme.

Note: See TracTickets for help on using tickets.