Changeset 52761
- Timestamp:
- 02/17/2022 05:42:09 PM (3 years ago)
- Location:
- branches/5.9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.9
- Property svn:mergeinfo changed
/trunk merged: 52734,52760
- Property svn:mergeinfo changed
-
branches/5.9/src/wp-admin/includes/file.php
r52425 r52761 1199 1199 && ( 0 === validate_file( $tmpfname_disposition ) ) 1200 1200 ) { 1201 $tmpfname_disposition = dirname( $tmpfname ) . '/' . $tmpfname_disposition; 1202 1201 1203 if ( rename( $tmpfname, $tmpfname_disposition ) ) { 1202 1204 $tmpfname = $tmpfname_disposition; -
branches/5.9/tests/phpunit/tests/admin/includesFile.php
r52382 r52761 112 112 'path traversal' => array( 'filter_content_disposition_header_with_filename_with_path_traversal' ), 113 113 'no quotes' => array( 'filter_content_disposition_header_with_filename_without_quotes' ), 114 ); 115 } 116 117 /** 118 * @ticket 55109 119 * @dataProvider data_save_to_temp_directory_when_getting_filename_from_content_disposition_header 120 * 121 * @covers ::download_url 122 * 123 * @param $filter A callback containing a fake Content-Disposition header. 124 */ 125 public function test_save_to_temp_directory_when_getting_filename_from_content_disposition_header( $filter ) { 126 add_filter( 'pre_http_request', array( $this, $filter ), 10, 3 ); 127 128 $filename = download_url( 'url_with_content_disposition_header' ); 129 $this->assertStringContainsString( get_temp_dir(), $filename ); 130 $this->unlink( $filename ); 131 132 remove_filter( 'pre_http_request', array( $this, $filter ) ); 133 } 134 135 /** 136 * Data provider for test_save_to_temp_directory_when_getting_filename_from_content_disposition_header. 137 * 138 * @return array 139 */ 140 public function data_save_to_temp_directory_when_getting_filename_from_content_disposition_header() { 141 return array( 142 'valid parameters' => array( 'filter_content_disposition_header_with_filename' ), 114 143 ); 115 144 }
Note: See TracChangeset
for help on using the changeset viewer.