WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 6 years ago

#890 closed enhancement (wontfix)

support relative paths for enclosures

Reported by: anonymousbugger Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Administration Keywords: needs-patch
Focuses: Cc:

Description

Currently, enclosures only work automatically if the URL in a post is an absolute URL. Please make them work for relative URLs as well. For example, adding a link such as <a href="/audio/mymusic.mp3"> should create an enclosure to http://www.myblog.com/audio/mymusic.mp3 and a link such as <a href="audio/mymusic.mp3"> should create an enclosure to http://www.mysite.com/blogpath/audio/mymusic.mp3">

Attachments (1)

relative_enclosures.diff (652 bytes) - added by markjaquith 9 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 @anonymousbugger10 years ago

  • Patch set to No

comment:2 @markjaquith9 years ago

  • Keywords bg|has-patch added
  • Milestone set to 2.1
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Patch fixes it. Tested. But note that your URI in the content is still going to be relative, which will break in RSS2 (but not Atom, from what I hear).

comment:3 @moogle9 years ago

The relative links also need to work from within pages other than the front page (ie: archive and category pages). Wouldn't this work?:

$content = str_replace(' href="/', ' href="http://' . $_SERVERHTTP_HOST? . '/' . $_SERVERREQUEST_URI?, $content);
$content = str_replace(" href='/", " href='http://" . $_SERVERHTTP_HOST? . '/' . $_SERVERREQUEST_URI?, $content);

comment:4 @moogle9 years ago

Oops, I meant:

$content = str_replace(' href="/', ' href="http://' . $_SERVERHTTP_HOST? . $_SERVERREQUEST_URI?, $content);

$content = str_replace(" href='/", " href='http://" . $_SERVERHTTP_HOST? . $_SERVERREQUEST_URI?, $content);

comment:5 @foolswisdom9 years ago

  • Keywords has-patch added; bg|has-patch removed

Hi Mark,

Is this still a worthwhile enhancement? Still targeted for 2.1? Does the patch need updating?

comment:6 @markjaquith9 years ago

  • Keywords 2nd-opinion added

Lloyd,

Patch still works. Still think it's worthwhile, although it's done in such a way as to execute quickly, with a simple str_replace instead of a more complicated regex, so I'd like another pair of eyes to sign off on it.

comment:7 @zamoose9 years ago

The patch looks good except for one thing: both relative and absolute server paths are caught by it and (incorrectly) routed to $SERVERHTTP_HOST?, n'est ce pas? The ticket submitter requested that both relative (audio/audio.mp3) and absolute (/audio/audio.mp3) work. Would not the current solution direct both links to http://$SERVER_URL/audio/audio.mp3, which is fine for /audio/audio.mp3 but which would be incorrect for anyone with a blog URL in any place other than the root for audio/audio.mp3. If there's no leading slash, oughtn't we just use bloginfo('url') or similar?

comment:8 @markjaquith9 years ago

zamoose,

Only domain-relative paths are caught.

Assuming all other relative paths to be relative based on the 'home' setting might be okay. Anyone else?

comment:9 @matt9 years ago

  • Milestone changed from 2.1 to 2.2

comment:10 @rob1n8 years ago

+1. Looks good.

comment:11 @foolswisdom8 years ago

  • Milestone changed from 2.2 to 2.3

comment:12 @Nazgul8 years ago

  • Milestone changed from 2.3 to 2.4 (next)

A 3 year old enhancement ticket. I didn't even know WordPress has been around that long. :)

I'd close it as wontfix because of lack of traction, but both rob1n and markjaquith showed an interest in it, so I'll leave it up to them.

comment:13 @markjaquith8 years ago

I'd still like this. :-) I'll tackle it for 2.4

comment:14 @Nazgul7 years ago

Mark, you missed 2.4. Retry for 2.5? ;)

comment:15 @ffemtcj7 years ago

  • Milestone changed from 2.5 to 2.6

comment:16 @Denis-de-Bernardy6 years ago

+1 to wontfix

comment:17 @Denis-de-Bernardy6 years ago

  • Keywords needs-patch added; has-patch 2nd-opinion removed

comment:18 @ryan6 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.