Skip to content

Commit

Permalink
enhance container name validation
Browse files Browse the repository at this point in the history
  • Loading branch information
GabsCoding committed Sep 14, 2024
1 parent 0538da4 commit 6a396c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/BlobStorage/Concerns/ValidateContainerName.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected function validateContainerName(string $name): void
{
$replaced = preg_replace('/[^a-z0-9-]/', '', $name);

if ($replaced !== $name) {
if (trim($name) === '' || $replaced !== $name) {
throw InvalidArgumentException::create("Invalid container name: {$name}");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ public function assertContainerName(string $name): void
'With Capital Letters' => ['TEST'],
'With Spaces' => ['test test'],
'With Special Chars' => ['test*'],
'Empty String' => [''],
]);

0 comments on commit 6a396c9

Please sign in to comment.