[wp-trac] [WordPress Trac] #38231: Allow download_url to respect content-disposition header
WordPress Trac
noreply at wordpress.org
Tue May 25 15:01:49 UTC 2021
#38231: Allow download_url to respect content-disposition header
--------------------------------------+------------------------------
Reporter: cklosows | Owner: johnjamesjacoby
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.8
Component: HTTP API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Changes (by psrpinto):
* keywords: has-patch needs-testing has-unit-tests => has-patch has-unit-
tests
Comment:
[attachment:38231.1.diff] improves on @cklosows's original patch by:
1. Explicitly checking the return value of `preg_match()`
2. Returning an error when the call to `wp_tempnam()` fails
3. Returning an error when the call to `rename()` fails
[attachment:38231-tests.1.diff] adds an extra assertion to make sure the
file is actually created.
I've also now manually tested this and can confirm the `Content-
Disposition` header is respected when calling `download_url()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38231#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list