[wp-trac] [WordPress Trac] #63384: Content-Disposition 'inline' filenames not respected by download_url()
WordPress Trac
noreply at wordpress.org
Fri May 2 08:31:45 UTC 2025
#63384: Content-Disposition 'inline' filenames not respected by download_url()
--------------------------+-----------------------------
Reporter: mi5t4n | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.9
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
# Content-Disposition 'inline' filename extraction not working in
download_url()
The download_url() function successfully extracts filenames from Content-
Disposition headers when they use the 'attachment' directive (e.g.,
`Content-Disposition: attachment; filename="xyz.png"`). However, the
function fails to extract filenames when the 'inline' directive is used
(e.g., `Content-Disposition: inline; filename="abc.jpg"`). This
inconsistency means filenames are only properly captured with the
'attachment' directive but are ignored when using 'inline'.
https://lh3.googleusercontent.com/a/ACg8ocIsaU5KyoziSpU_mP5OpE-
dzbmc8hoyOEXemog5RopRRoqTz2Y=s96-c
Example URL:
{{{#!php
<?php
File: src/wp-admin/includes/file.php
1221:
1222: if ( str_starts_with( $content_disposition, 'attachment;
filename=' ) ) {
1223: $tmpfname_disposition = sanitize_file_name(
substr( $content_disposition, 21 ) );
1224: } else {
1225: $tmpfname_disposition = '';
1226: }
}}}
[[Image()]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63384>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list