Code Duplication    Length = 4-7 lines in 2 locations

_inc/lib/class.media.php 1 location

@@ 198-204 (lines=7) @@
195
		);
196
197
		add_filter( 'jetpack_supported_media_sideload_types', $mime_type_static_filter );
198
		if (
199
			! self::is_file_supported_for_sideloading( $tmp_filename ) &&
200
			! file_is_displayable_image( $tmp_filename )
201
		) {
202
			@unlink( $tmp_filename );
203
			return new WP_Error( 'invalid_input', 'Invalid file type.', 403 );
204
		}
205
		remove_filter( 'jetpack_supported_media_sideload_types', $mime_type_static_filter );
206
207
		// generate a new file name

class.json-api-endpoints.php 1 location

@@ 1866-1869 (lines=4) @@
1863
1864
		// First check to see if we get a mime-type match by file, otherwise, check to
1865
		// see if WordPress supports this file as an image. If neither, then it is not supported.
1866
		if ( ! $this->is_file_supported_for_sideloading( $tmp ) || 'image' === $type && ! file_is_displayable_image( $tmp ) ) {
1867
			@unlink( $tmp );
1868
			return new WP_Error( 'invalid_input', 'Invalid file type.', 403 );
1869
		}
1870
1871
		// emulate a $_FILES entry
1872
		$file_array = array(