WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 17 months ago

#22671 new defect (bug)

Attachment pages 404 for media attached to an "Auto Draft"

Reported by: miqrogroove Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.4.2
Component: Media Keywords: close
Focuses: Cc:

Description

Any image uploaded to a new post through the post editor or QuickPress has a broken View link in the Media Library. To reproduce:

  1. Go to Dashboard.
  2. Upload an image in QuickPress.
  3. Go to Media Library.
  4. Click the View link for the image.

Expected result:

I thought it was going to show me the image or the image's attachment page.

Actual result:

"This is somewhat embarrassing, isn't it?" - 404 message from URL like /?attachment_id=112

This won't happen if the image is uploaded via the Upload New Media page.

Attachments (2)

miqro-admin-bar.patch (529 bytes) - added by miqrogroove 17 months ago.
Removes the broken link in the admin bar.
miqro-media-list.patch (862 bytes) - added by miqrogroove 17 months ago.
Removes the broken links in the media library.

Download all attachments as: .zip

Change History (15)

comment:1 follow-up: ocean9017 months ago

I think this is expected. When you upload an attachment it will be attached to the post. When nothing is changed it's an auto-draft. So the image will be attached to an auto-draft. Auto-drafts aren't public. The post status of an attachment is inherit, means it's non-public too.

The same happens, when you upload an image to a non-public post, like a pending post. A user which isn't logged in can't see the attachment too.

Version 1, edited 17 months ago by ocean90 (previous) (next) (diff)

comment:2 in reply to: ↑ 1 ; follow-up: miqrogroove17 months ago

Replying to ocean90:

The same happens, when you upload an image to a non-public post, like a pending post.

ocean90, I am unable to reproduce the behavior you're describing here. If I attach an image to a normal draft and save it, then the View link is not broken in Media Library.

comment:3 in reply to: ↑ 2 ; follow-up: SergeyBiryukov17 months ago

Replying to miqrogroove:

ocean90, I am unable to reproduce the behavior you're describing here. If I attach an image to a normal draft and save it, then the View link is not broken in Media Library.

I can reproduce the 404 message when I'm logged out.

comment:4 in reply to: ↑ 3 ; follow-up: miqrogroove17 months ago

Replying to SergeyBiryukov:

I can reproduce the 404 message when I'm logged out.

If you're logged out, how are you seeing the Media Library?

comment:5 in reply to: ↑ 4 ; follow-up: ocean9017 months ago

  • Keywords close added

Replying to miqrogroove:

If you're logged out, how are you seeing the Media Library?

You can copy the attachment link and paste it to a private tab for example… It's just an example for how core does handle the post status of attachments. And that it's expected.

comment:6 in reply to: ↑ 5 miqrogroove17 months ago

Replying to ocean90:

You can copy the attachment link and paste it to a private tab for example… It's just an example for how core does handle the post status of attachments. And that it's expected.

Actually I don't see how that is relevant. I am getting broken links depending on which admin page I use to upload images. I am not copying links between browsers.

comment:7 follow-up: nacin17 months ago

Images attached to a post inherit the post's status. Images uploaded separately (and thus unattached) are simply published as-is. That's the relevance.

comment:8 in reply to: ↑ 7 miqrogroove17 months ago

Replying to nacin:

Images attached to a post inherit the post's status. Images uploaded separately (and thus unattached) are simply published as-is. That's the relevance.

Still confused here. Err... You are drawing an analogy between what is supposed to be publicly viewable vs. publicly inaccessible. While I don't disagree with that information, it is inconsistent with the bug I'm reporting. I think we need a matrix to explain this:

+------+----------+-----+----------+
|Viewer|Unattached|Draft|Auto-Draft|
+------+----------+-----+----------+
|Admin |   OK     | OK  |   404    |
+------+----------+-----+----------+
|Public|   OK     | 404 |   404    |
+------+----------+-----+----------+

Whether or not things are publicly viewable, they should not have broken links on the admin side.

comment:9 miqrogroove17 months ago

Also, in addition to the broken View link, after clicking the Edit link for one of these images a broken link gets added to the toolbar that says "View Attachment Page".

comment:10 miqrogroove17 months ago

The broken "View Attachment Page" link is new in 3.5. Do you need a separate ticket for that?

miqrogroove17 months ago

Removes the broken link in the admin bar.

miqrogroove17 months ago

Removes the broken links in the media library.

comment:11 follow-up: helenyhou17 months ago

Thinking through it a bit, it seems to me that there's a base issue of why attachments get attached to auto drafts that are no longer accessible to edit in the admin, except from the "Uploaded to" column on the media list table. We can hide the link, but that doesn't change the weirdness of having an "Auto Draft" post that doesn't show up in the posts list table.

comment:12 in reply to: ↑ 11 miqrogroove17 months ago

Replying to helenyhou:

We can hide the link, but that doesn't change the weirdness of having an "Auto Draft" post that doesn't show up in the posts list table.

Also, there's no way to attach auto-draft images to new posts. You can insert them, but if you link them to the Attachment Page those will be broken too.

comment:13 helenyhou17 months ago

  • Summary changed from Media View Links Are 404 to Attachment pages 404 for media attached to an "Auto Draft"
Note: See TracTickets for help on using tickets.