WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 16 months ago

#19918 new defect (bug)

Attachments are viewable from any permalink that matches their slug

Reported by: prorock Owned by: Adrian (designmodo.com)
Priority: normal Milestone: Awaiting Review
Component: Permalinks Version: 3.2
Severity: major Keywords: has-patch dev-feedback
Cc:

Description

I see one problem in WordPress, for example if you upload an images with name comments.png, all your url contain hide url like: /comments

example:
original post: yourdomain.com/myarticle
if you have in media gallery file with name comments.png url will be: yourdomain.com/myarticle/comments
or
yourdomain.com/myarticle2/comments
or
yourdomain.com/myarticle3/comments

and all this url's contain the same comment box.

my users report this problem, because if i share in twitter or g+ one link, many users redirect not to the post but to url with /comments in the end.

Adrian,

designmodo.com

Attachments (1)

19918.diff (778 bytes) - added by solarissmoke 16 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 thee1717 months ago

This would likely also effect images named page, feed, or trackback as well.

comment:2 SergeyBiryukov17 months ago

Not sure what the problem is. My steps:

  1. Switched permalink structure to /%postname%/.
  2. Created and published a new post: /test8/
  3. On Edit Post screen, uploaded comments.jpg image.
  4. URL of the post is still the same (/test8/) and opens the post without a redirect.
  5. URL of the uploaded image is /test8/comments/ and opens the image.

comment:3 prorock17 months ago

Sergey, try to create posts like /test9 and /test10 without upload any images and type in browser /test9/comments/ /test9/comments/ will appear the same image that in case of /test8/comments/

comment:4 SergeyBiryukov17 months ago

Ah, I see. Confirmed.

comment:5 prorock17 months ago

Good, waiting others for confirmation.

comment:6 solarissmoke17 months ago

  • Component changed from Comments to Permalinks
  • Summary changed from File name convert to URL to Attachments are viewable from any permalink that matches their slug
  • Version changed from 3.3.1 to 3.2

This seems to be a wider issue than what was originally reported. Basically, you can view an attachment by appending it's slug to the link for any post! To reproduce:

  • Use pretty permalinks (the exact structure doesn't matter)
  • Add an attachment to a post (e.g., with attachment URL /2012/01/30/my-post/my-attachment/)
  • Now you can view that attachment by appending the attachment slug to any other post. For example /2012/01/01/hello-world/my-attachment/ or /2011/11/01/another-random-post/my-attachment/.

The name of the attachment doesn't matter.

I can reproduce this in WP 3.2 (and 3.3, trunk). Don't have an earlier version running at the moment.

comment:7 prorock17 months ago

  • Version changed from 3.2 to 3.3.1

In 3.3.1 is the same problem, so don't change version :)

Thanks

comment:8 solarissmoke17 months ago

  • Version changed from 3.3.1 to 3.2

The version field is used to identify the earliest version at which the bug exists. Because it says 3.2 doesn't mean it doesn't exist in 3.3.

comment:9 nacin16 months ago

Sounds like something that should probably be handled by canonical.

solarissmoke16 months ago

comment:10 solarissmoke16 months ago

  • Keywords has-patch dev-feedback added

Here's a patch for starters. It fixes the issue for me, but I'm not too familiar with canonical so there is probably a better/more correct way to do it.

Note: See TracTickets for help on using tickets.