Skip to content

Commit

Permalink
Update Upload.php
Browse files Browse the repository at this point in the history
  • Loading branch information
nokonoko authored May 13, 2023
1 parent 6056104 commit 834e65f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Classes/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function doubleDotExtension(array $extension):string
*
* @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'], '.')){
$extension = explode('.', $file['name']);
Expand All @@ -258,7 +258,7 @@ public function fileExtension(array $file):?string
default => end($extension)
};
}
return "NOEXT";
return false;
}

/**
Expand Down Expand Up @@ -311,7 +311,7 @@ public function generateName(string $extension):string
$index = rand(0, strlen($this->Connector->CONFIG['ID_CHARSET']) - 1);
$NEW_NAME .= $this->Connector->CONFIG['ID_CHARSET'][$index];
}
if ($extension != "NOEXT") {
if ($extension) {
$NEW_NAME .= '.' . $extension;
}
} while ($this->Connector->dbCheckNameExists($NEW_NAME));
Expand Down

0 comments on commit 834e65f

Please # to comment.