1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-07 02:04:04 +00:00

Add string check to validateFilename, swap validation order

Validate characters first, only then throw if the filename is a directory.
This commit is contained in:
lukinovec 2026-05-01 09:16:17 +02:00
parent d3607f84bf
commit e8168eb0b9

View file

@ -105,10 +105,10 @@ trait ValidatesDatabaseParameters
*/
protected function validateFilename(string|null $filename): void
{
if (is_dir($filename)) {
$this->validateParameter($filename, static::allowedFilenameCharacters());
if (is_string($filename) && is_dir($filename)) {
throw new InvalidArgumentException("Filename '{$filename}' is a directory.");
}
$this->validateParameter($filename, static::allowedFilenameCharacters());
}
}