Make WordPress Core

Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#3150 closed defect (bug) (fixed)

'link to page' attachment permalink incorrect, if using a relative WordPress URL starting with '/'

Reported by: zjohnjohnz's profile zjohnjohnz Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.0.4
Component: Administration Keywords: attachment, link to page, relative URL, 2nd-opinion, has-patch
Focuses: Cc:

Description

[version 2.04]

Under Options -> General, if set the WordPress address URL to a relative path beginning with a slash, (e.g., "/wordpress-2.04"), then "link to page" style attachment URLs are re-written incorrectly.

For example, this is what is inserted into the editor buffer for a link to page attachment:

<a id="p13" rel="attachment" href="wordpress-2.04/2006/09/20/test3/ts4/" title="ts4">ts4</a>

The href is missing the needed leading "/", however. Correct is:

a id="p13" rel="attachment" href="/wordpress-2.04/2006/09/20/test3/ts4/" title="ts4">ts4</a>

Possible Fix:

It appears that the fix is extremely simple: on line 120 of
wp-includes/template-functions-links.php change 'trim' to 'rtrim'.

Attachments (1)

3150.patch.txt (486 bytes) - added by foolswisdom 19 years ago.

Download all attachments as: .zip

Change History (6)

#1 @foolswisdom
19 years ago

  • Keywords 2nd-opinion has-patch added
  • Milestone set to 2.1
  • Summary changed from 'link to page' attachment permalink incorrect, if using a relative WordPress URL to 'link to page' attachment permalink incorrect, if using a relative WordPress URL starting with '/'

Attached patch of trunk based on zjohnjohnz well written bug and proposed fix above.

#2 @mattProject Lead
18 years ago

  • Milestone changed from 2.1 to 2.2

#3 @foolswisdom
18 years ago

  • Milestone changed from 2.2 to 2.3

#4 follow-up: @ryanLead Tester
18 years ago

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

Looks like this is now fixed by using trailingslashit.

#5 in reply to: ↑ 4 @westiLead Developer
18 years ago

Replying to ryan:

Looks like this is now fixed by using trailingslashit.

Yes. Fixed in [6095] for #2801

Note: See TracTickets for help on using tickets.