{
"name": "uguu",
- "version": "1.6.6",
+ "version": "1.6.7",
"description": "Uguu is a simple lightweight temporary file host with support for drop, paste, click and API uploading.",
"homepage": "https://uguu.se",
"repository": {
$hash = sha1_file($file['tmp_name']);
$this->FILE_INFO = [
'TEMP_NAME' => $file['tmp_name'],
- 'NAME' => strip_tags($file['name']),
+ 'NAME' => strip_tags($this->checkNameLength($file['name'])),
'SIZE' => $file['size'],
'SHA1' => $hash,
'EXTENSION' => $this->fileExtension($file),
return match ($dotCount) {
0 => null,
1 => end($extension),
- 2 => $this->doubleDotExtension($extension)
+ 2 => $this->doubleDotExtension($extension),
+ default => end($extension)
};
}
throw new Exception('Filetype not allowed.', 415);
}
}
+
+ public function checkNameLength(string $fileName): string {
+ if (strlen($fileName) > 250) {
+ return substr($fileName, 0, 250);
+ } else {
+ return $fileName;
+ }
+ }
/**
* Generates a random string of characters, checks if it exists in the database,