Make WordPress Core

Opened 17 years ago

Closed 14 years ago

#7040 closed defect (bug) (fixed)

Link to File changes to Link to Attachment IF PAGE IS STARTPAGE

Reported by: shusha's profile shusha Owned by: westi's profile westi
Milestone: 3.0 Priority: high
Severity: major Version: 2.5.1
Component: Media Keywords:
Focuses: Cc:

Description

bug when editing a page which is set as static blog start page:
when inserting a link to a mediafile, wp inserts this "rel="attachment..." tag, even if "file URL" was selected. this causes the link to change to the attachment instead of linking to the file directly.

if i change the startpage to some other page/article before editing the page, everything works fine.

this bug appears first time in wp 2.51.
in wp 2.5, it was fine.

i tested it only on pages, not on articles.

Change History (20)

#1 @westi
16 years ago

  • Milestone 2.7 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Tested on trunk-rev-10112 and works fine for me.

Closing as WORKSFORME.

#2 follow-up: @KathyReid
16 years ago

  • Component changed from Administration to Gallery
  • Keywords gallery media added; multimedia removed
  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Version set to 2.7

I have replicated this and believe it to be an active bug - reopening.
Took a quick look at the code but am not sure how the
rel="reference" attribute
is handled for links that are generated from the Media Library.

Regards,
Kathy

#3 in reply to: ↑ 2 @westi
16 years ago

  • Keywords reporter-feedback added; gallery startpage media removed
  • Owner changed from anonymous to westi
  • Status changed from reopened to new

Replying to KathyReid:

I have replicated this and believe it to be an active bug - reopening.
Took a quick look at the code but am not sure how the
rel="reference" attribute
is handled for links that are generated from the Media Library.

Regards,
Kathy

Can you detail how you reproduced this please as when I tested it worked fine.

#4 @tortillasoup
16 years ago

  • Priority changed from normal to high

I can confirm this error. I am using 2.7 and have tested this on two different sites. When attempting to insert a pdf on the main page of the website rather than linking to the pdf a link to a post page is created and on that page a link will appear in the body to the actual document. Before publishing I have checked the link for the correct path to the pdf as well as once inserted i check the path using the "insert/edit link" button to check the path one last time. After the page is published I view it and what you get is a link to http://www.xxxxxxx.com/xxxxxpost instead of http://www.xxxxxx.com/xxxx.pdf . I have tested this on other pages outside of the main / static page and it works. Error only occurs when attempting to insert media in the main page.

Using Wordpress 2.7

  1. open / edit main page
  2. click "add media" button
  3. click select files (flash loader button does not work, I think it may because of Flash Player 10)
  4. select document (pdf)
  5. select "file URL" in the Link URL option. This used to be the default, now an option must be chosen
  6. select insert to post
  7. click in the link in the post box and then select "link / edit" button
  8. verify correct path to the document
  9. publish page
  10. view page / link will not be to document rather to a post
  11. only happens on main page / works on all others

Hope this helps. I set the priority to high only because this is a productivity issue for some of my clients attempting to update their sites.

#5 @hakre
16 years ago

Confirmation for 2.7.1 reported (and reproduced) today.

#6 follow-up: @hakre
16 years ago

Westi: you might set the static homepage option.

#7 in reply to: ↑ 6 @westi
16 years ago

  • Keywords reporter-feedback removed
  • Milestone set to 2.8

Replying to hakre:

Westi: you might set the static homepage option.

I'm pretty sure I tried that at the time.

But I will give this another look,

#8 @swift
16 years ago

  • Version changed from 2.7 to 2.7.1

I can confirm that this bug is still present in WP 2.7.1

I had the issue when trying to insert a link to a PDF file in the Media Library into the (static) homepage page. The rel attribute was getting added and then on updating the page, the link would get re-written replacing the "wp-content/upload/year/month/day/" with the page name and dropping the ".pdf" extension and so WP takes you to an intermediate page which then gives the proper link to the file.

Also, it appears to only be an issue for links on the homepage, with the static homepage option set, I can properly add links to the same PDF onto other pages.

#9 @Denis-de-Bernardy
16 years ago

rel=attachment doesn't seem to occur in trunk.

#10 @Denis-de-Bernardy
16 years ago

  • Keywords reporter-feedback added

can't reproduce the other issue.

can anyone outline a step by step procedure to reproduce the issue?

#11 @Denis-de-Bernardy
16 years ago

  • Milestone 2.8 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

please reopen with steps to reproduce

#12 @WesleyC
15 years ago

  • Component changed from Gallery to Media
  • Resolution worksforme deleted
  • Severity changed from normal to major
  • Status changed from closed to reopened
  • Version changed from 2.7.1 to 2.9.2

The bug still exists in 2.9.2

To reproduce simply download the 2.9.2 version (I use czech language mutation, but there should be no difference).
Do the fresh installation. Go to options-reading.php, set static page as the first page, you can choose that "about me" page. Then go to edit-pages.php, edit that sample page that is already there and you did set it as first page.
Add a file and you will see in the HTML that the link is someting like: "<a href='http://site/ai/wp-content/uploads/2010/03/letak_voziky1.pdf' rel='attachment wp-att-6'>letak_voziky</a>".
Notice that: rel='attachment wp-att-6'
After you publish, you will get: <a href='http://site/ai/?attachment_id=6' rel='attachment wp-att-6'>letak_voziky</a>.
Now the pdfd extension is gone, and you have to download it through another page, which is very annoying.

This has been done on fresh installation, no other changes to installation has been made, no .htaccess, no another plugin, nothing, just new install.

#13 @dd32
15 years ago

  • Keywords reporter-feedback removed
  • Milestone set to 3.0
  • Version changed from 2.9.2 to 2.5.1

Confirmed under trunk.

You must upload a non-media filetype to trigger it.

Post-URL with image: rel=attachment
File-URL with image: no rel
Post-URL with .txt: rel=attachment
File-URL with .txt: rel=attachment

#14 @dd32
15 years ago

Traced it down to this line: http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/media.php#L465

if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
    $rel = " rel='attachment wp-att-" . esc_attr($send_id)."'";

The 2nd case will always be matched for page_on_front, as the post permalink is home_url(), So as long as uploads are stored in a subdirectory of homeurl at least..

#15 @dd32
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [13875]) Do not add rel="attachment" for direct(File URL, not Post URL) links to non-media files in "Insert into Post". Fixes #7040

#16 @taf2
15 years ago

Using latest nightly, I believe revision: 14285 I'm seeing this issue again.

#17 @taf2
15 years ago

Okay, I figured out if I first unlink the image. Than relink to the new target URL it works fine. I think that work around is sufficient when known.

#18 @danorton
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.5.1 to 3.0.1

Persists (or regresses) in 3.0.1.

#19 @danorton
14 years ago

The fix above (changeset [13875]) looks like its intent was to fix the cause, but not fix the problem for pages that already have the "rel" attribute in such links.

#20 @dd32
14 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
  • Version changed from 3.0.1 to 2.5.1

Please do not change the version for reported issues, unless its being changed to an earlier version.

The fix indeed fixes the cause of the problem, it does not retroactively affect posts. If you'd like to have this happen, please open a new ticket and reference this one.

Note: See TracTickets for help on using tickets.