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