Opened 11 years ago
Closed 4 years ago
#24824 closed defect (bug) (wontfix)
get_attached_file() treats fully qualified URLs as relative
Reported by: | tobiaskochsonlinenet | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.7 |
Component: | Media | Keywords: | dev-feedback has-patch has-unit-tests |
Focuses: | Cc: |
Description
If you call the function get_attached_file() of wp-include/post.php with a fully qualified URL (like "http://www.example.com/file.ext") it will prepend the upload directory.
Checking the file's URI for ://
would prevent this.
!preg_match('|^://|', $file)
Attachments (2)
Change History (11)
#5
@
7 years ago
- Keywords has-patch added
1.)
Related: 36308 patch fixes Windows paths and also makes the expression more compact.
2.)
This patch, which adds on top of the patch above, also fixes URL paths by prevent an URL from going into the relative path conditional.
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
4 years ago
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
4 years ago
#9
@
4 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
It's currently possible to use the get_attached_file
filter to modify the function to use full URLs. With that consideration it was agreed in a recent Media bug scrub through older issues that this is best fit for a plugin (as one of the attendees actually had an example plugin using the filter for this reason.)
Marking this wontfix to keep our open ticket list accurate to component goals.
Oops, actually the regular expression should read: