Changeset 52734
- Timestamp:
- 02/15/2022 05:47:39 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/file.php
r52640 r52734 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; -
trunk/tests/phpunit/tests/admin/includesFile.php
r52382 r52734 103 103 104 104 /** 105 * @ticket #55109 106 * @dataProvider data_save_to_temp_directory_when_getting_filename_from_content_disposition_header 107 * 108 * @covers ::download_url 109 * 110 * @param $filter A callback containing a fake Content-Disposition header. 111 */ 112 public function test_save_to_temp_directory_when_getting_filename_from_content_disposition_header( $filter ) { 113 add_filter( 'pre_http_request', array( $this, $filter ), 10, 3 ); 114 115 $filename = download_url( 'url_with_content_disposition_header' ); 116 $this->assertStringContainsString( get_temp_dir(), $filename ); 117 $this->unlink( $filename ); 118 119 remove_filter( 'pre_http_request', array( $this, $filter ) ); 120 } 121 122 /** 105 123 * Data provider for test_download_url_should_respect_filename_from_content_disposition_header. 106 124 * … … 112 130 'path traversal' => array( 'filter_content_disposition_header_with_filename_with_path_traversal' ), 113 131 'no quotes' => array( 'filter_content_disposition_header_with_filename_without_quotes' ), 132 ); 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.