mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 16:24:03 +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:
parent
d3607f84bf
commit
e8168eb0b9
1 changed files with 3 additions and 3 deletions
|
|
@ -105,10 +105,10 @@ trait ValidatesDatabaseParameters
|
||||||
*/
|
*/
|
||||||
protected function validateFilename(string|null $filename): void
|
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.");
|
throw new InvalidArgumentException("Filename '{$filename}' is a directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->validateParameter($filename, static::allowedFilenameCharacters());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue