DataUploadEvent already asserts that file exist
This commit is contained in:
		
							parent
							
								
									c5d8585824
								
							
						
					
					
						commit
						77fc510bb3
					
				| @ -54,10 +54,6 @@ class FlashFileHandler extends DataHandlerExtension | |||||||
| 
 | 
 | ||||||
|     protected function check_contents(string $tmpname): bool |     protected function check_contents(string $tmpname): bool | ||||||
|     { |     { | ||||||
|         if (!file_exists($tmpname)) { |  | ||||||
|             return false; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         $fp = fopen($tmpname, "r"); |         $fp = fopen($tmpname, "r"); | ||||||
|         $head = fread($fp, 3); |         $head = fread($fp, 3); | ||||||
|         fclose($fp); |         fclose($fp); | ||||||
|  | |||||||
| @ -48,9 +48,6 @@ class IcoFileHandler extends DataHandlerExtension | |||||||
| 
 | 
 | ||||||
|     protected function check_contents(string $file): bool |     protected function check_contents(string $file): bool | ||||||
|     { |     { | ||||||
|         if (!file_exists($file)) { |  | ||||||
|             return false; |  | ||||||
|         } |  | ||||||
|         $fp = fopen($file, "r"); |         $fp = fopen($file, "r"); | ||||||
|         $header = unpack("Snull/Stype/Scount", fread($fp, 6)); |         $header = unpack("Snull/Stype/Scount", fread($fp, 6)); | ||||||
|         fclose($fp); |         fclose($fp); | ||||||
|  | |||||||
| @ -51,14 +51,7 @@ class MP3FileHandler extends DataHandlerExtension | |||||||
| 
 | 
 | ||||||
|     protected function check_contents(string $tmpname): bool |     protected function check_contents(string $tmpname): bool | ||||||
|     { |     { | ||||||
|         $success = false; |  | ||||||
| 
 |  | ||||||
|         if (file_exists($tmpname)) { |  | ||||||
|         $mimeType = getMimeType($tmpname); |         $mimeType = getMimeType($tmpname); | ||||||
| 
 |         return ($mimeType == 'audio/mpeg'); | ||||||
|             $success = ($mimeType == 'audio/mpeg'); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         return $success; |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -63,9 +63,6 @@ class PixelFileHandler extends DataHandlerExtension | |||||||
|     protected function check_contents(string $tmpname): bool |     protected function check_contents(string $tmpname): bool | ||||||
|     { |     { | ||||||
|         $valid = [IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_WEBP]; |         $valid = [IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_WEBP]; | ||||||
|         if (!file_exists($tmpname)) { |  | ||||||
|             return false; |  | ||||||
|         } |  | ||||||
|         $info = getimagesize($tmpname); |         $info = getimagesize($tmpname); | ||||||
|         if (!$info) { |         if (!$info) { | ||||||
|             return false; |             return false; | ||||||
|  | |||||||
| @ -98,10 +98,6 @@ class SVGFileHandler extends DataHandlerExtension | |||||||
| 
 | 
 | ||||||
|     protected function check_contents(string $file): bool |     protected function check_contents(string $file): bool | ||||||
|     { |     { | ||||||
|         if (!file_exists($file)) { |  | ||||||
|             return false; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         $msp = new MiniSVGParser($file); |         $msp = new MiniSVGParser($file); | ||||||
|         return bool_escape($msp->valid); |         return bool_escape($msp->valid); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -126,9 +126,6 @@ class VideoFileHandler extends DataHandlerExtension | |||||||
| 
 | 
 | ||||||
|     protected function check_contents(string $tmpname): bool |     protected function check_contents(string $tmpname): bool | ||||||
|     { |     { | ||||||
|         return ( |         return in_array(getMimeType($tmpname), self::SUPPORTED_MIME); | ||||||
|             file_exists($tmpname) && |  | ||||||
|             in_array(getMimeType($tmpname), self::SUPPORTED_MIME) |  | ||||||
|         ); |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user