DataUploadEvent already asserts that file exist

This commit is contained in:
Shish 2020-02-23 16:13:08 +00:00
parent c5d8585824
commit 77fc510bb3
6 changed files with 3 additions and 27 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;
$mimeType = getMimeType($tmpname);
return ($mimeType == 'audio/mpeg');
}
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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);
}
}