Ticket #890 (closed enhancement: wontfix)
support relative paths for enclosures
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Administration | Version: | 1.5 |
| Severity: | normal | Keywords: | needs-patch |
| 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
Change History
comment:2
markjaquith — 6 years ago
- Keywords bg|has-patch added
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
- Milestone set to 2.1
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).
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);
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
foolswisdom — 5 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
markjaquith — 5 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.
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
markjaquith — 5 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:10
rob1n — 5 years ago
+1. Looks good.
comment:12
Nazgul — 4 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
markjaquith — 4 years ago
I'd still like this. :-) I'll tackle it for 2.4
comment:14
Nazgul — 4 years ago
Mark, you missed 2.4. Retry for 2.5? ;)
+1 to wontfix
- Keywords needs-patch added; has-patch 2nd-opinion removed
comment:18
ryan — 2 years ago
- Status changed from accepted to closed
- Resolution set to wontfix
- Milestone 2.9 deleted

