Opened 10 years ago
Last modified 7 months ago
#30922 new defect (bug)
Link Manager: Doesn't support relative URLs for "Image Address"
Reported by: | hartwork | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
For links, the "Edit Link" page allows be to put in any of
http://blog.hartwork.org/__images/gentoo3-150x30.png
https://blog.hartwork.org/__images/gentoo3-150x30.png
/__images/gentoo3-150x30.png
for a working image URL but
- it mis-corrects
__images/gentoo3-150x30.png
tohttp://__images/gentoo3-150x30.png
and - setting it to
//blog.hartwork.org/__images/gentoo3-150x30.png
remains untouched but results in broken final URLhttp://blog.hartwork.org//blog.hartwork.org/__images/gentoo3-150x30.png
on the blog itself (which is unexpected).
Without patching code, what are my options?
This behaviour is actually not new in 4.1 btw.
Change History (5)
#2
@
10 years ago
- Summary changed from [4.1] Managing Links: Broken handling of "Image Address" URLs? to Link Manager: Broken handling of "Image Address" URLs?
#3
follow-up:
↓ 4
@
10 years ago
- Keywords dev-feedback close added
- Summary changed from Link Manager: Broken handling of "Image Address" URLs? to Link Manager: Doesn't support relative URLs for "Image Address"
It definitely seems like the Link Manager doesn't support relative URLs. Not sure whether we're even still supporting enhancements to the this area since it was split off to a plugin a few releases ago.
#4
in reply to:
↑ 3
@
10 years ago
- Keywords dev-feedback close removed
Replying to DrewAPicture:
It definitely seems like the Link Manager doesn't support relative URLs. Not sure whether we're even still supporting enhancements to the this area since it was split off to a plugin a few releases ago.
All the plugin currently does is to enable the existing UI, so this seems like worthwhile fix.
#5
@
7 months ago
I think this issue was originally slightly mis-reported, or has somehow since changed from the time.
This version with the single forward slash at the start appears to work just fine now.
/__images/gentoo3-150x30.png
Without the slash at the front, it's generating the issue still, as well as trying to use the domain without the protocol.
I feel one solution could be with relative paths, check if the link image doesn't start with a single /
, prepend for the user. However, trying to check for protocol-less domain may be a bit more code than preferred for a feature that is hidden for majority of the installs. Perhaps something like this for the first variation
} else { // If it's a relative path. $sep = ''; if ( ! str_starts_with( $bookmark->link_image, '/' ) { $sep = '/'; } $output .= '<img src="' . get_option( 'siteurl' ) . $sep . $bookmark->link_image . '"' . $alt . $title . ' />'; }
I think this could fix the most appropriate relative URL attempts.
PS:
/__images/gentoo3-150x30.png
also ends up pointing tohttp://
rather thanhttps://
if the blog master URL starts withhttp://
despite the user viewing thehttps://
version. I'd expect SSL-support from a relative link. Thanks!