Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#22671 closed defect (bug) (wontfix)

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

Reported by: miqrogroove's profile miqrogroove Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: Media Keywords: has-patch
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 (3)

miqro-admin-bar.patch (529 bytes) - added by miqrogroove 12 years ago.
Removes the broken link in the admin bar.
miqro-media-list.patch (862 bytes) - added by miqrogroove 12 years ago.
Removes the broken links in the media library.
22671.diff (683 bytes) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (18)

#1 follow-up: @ocean90
12 years 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.

Related: #22556

Last edited 12 years ago by ocean90 (previous) (diff)

#2 in reply to: ↑ 1 ; follow-up: @miqrogroove
12 years 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.

#3 in reply to: ↑ 2 ; follow-up: @SergeyBiryukov
12 years 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.

#4 in reply to: ↑ 3 ; follow-up: @miqrogroove
12 years 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?

#5 in reply to: ↑ 4 ; follow-up: @ocean90
12 years 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.

#6 in reply to: ↑ 5 @miqrogroove
12 years 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.

#7 follow-up: @nacin
12 years 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.

#8 in reply to: ↑ 7 @miqrogroove
12 years 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.

#9 @miqrogroove
12 years 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".

#10 @miqrogroove
12 years ago

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

@miqrogroove
12 years ago

Removes the broken link in the admin bar.

@miqrogroove
12 years ago

Removes the broken links in the media library.

#11 follow-up: @helenyhou
12 years 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.

#12 in reply to: ↑ 11 @miqrogroove
12 years 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.

#13 @helenyhou
12 years ago

  • Summary changed from Media View Links Are 404 to Attachment pages 404 for media attached to an "Auto Draft"

#14 @wonderboymusic
11 years ago

  • Keywords has-patch commit added; close removed
  • Milestone changed from Awaiting Review to 4.0

22671.diff would fix it - brings the attachment out of limbo and seems to follow the behavior of showing an attachment like [28791].

#15 @wonderboymusic
11 years ago

  • Keywords commit removed
  • Milestone 4.0 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

After messing around with this, the behavior is correct. Edge case limbo, but correct.

Note: See TracTickets for help on using tickets.