WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#24824 new defect (bug)

get_attached_file() treats fully qualified URLs as relative

Reported by: tobiaskochsonlinenet Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.7
Component: Media Keywords: has-patch
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)

Change History (2)

comment:1 tobiaskochsonlinenet9 months ago

Oops, actually the regular expression should read:

!preg_match('|://|', $file)

comment:2 SergeyBiryukov9 months ago

  • Version changed from trunk to 2.7

Related: [8796], [9242].

Note: See TracTickets for help on using tickets.