Update Upload.php

pull/89/head v.1.7.2
Go Johansson (neku) 2023-05-13 03:15:45 +02:00 committed by GitHub
parent 6056104c83
commit 834e65f1b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -247,7 +247,7 @@
* *
* @return string The file extension of the file. * @return string The file extension of the file.
*/ */
public function fileExtension(array $file):?string public function fileExtension(array $file):string | bool
{ {
if(str_contains($file['name'], '.')){ if(str_contains($file['name'], '.')){
$extension = explode('.', $file['name']); $extension = explode('.', $file['name']);
@ -258,7 +258,7 @@
default => end($extension) default => end($extension)
}; };
} }
return "NOEXT"; return false;
} }
/** /**
@ -311,7 +311,7 @@
$index = rand(0, strlen($this->Connector->CONFIG['ID_CHARSET']) - 1); $index = rand(0, strlen($this->Connector->CONFIG['ID_CHARSET']) - 1);
$NEW_NAME .= $this->Connector->CONFIG['ID_CHARSET'][$index]; $NEW_NAME .= $this->Connector->CONFIG['ID_CHARSET'][$index];
} }
if ($extension != "NOEXT") { if ($extension) {
$NEW_NAME .= '.' . $extension; $NEW_NAME .= '.' . $extension;
} }
} while ($this->Connector->dbCheckNameExists($NEW_NAME)); } while ($this->Connector->dbCheckNameExists($NEW_NAME));