From 4ac630c18615bef692540a15606a8664a1b897c2 Mon Sep 17 00:00:00 2001 From: "Luke B. Silver" <22452787+loks0n@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:27:18 +0100 Subject: [PATCH 1/3] fix: accept lowercase file extensions Cameras and other media sources often output uppercase extensions such as 'JPG'. These extensions should also be accepted. --- src/Storage/Validator/FileExt.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Storage/Validator/FileExt.php b/src/Storage/Validator/FileExt.php index 80506c2d..34d72288 100644 --- a/src/Storage/Validator/FileExt.php +++ b/src/Storage/Validator/FileExt.php @@ -46,6 +46,7 @@ public function getDescription(): string public function isValid($filename): bool { $ext = pathinfo($filename, PATHINFO_EXTENSION); + $ext = strtolower($ext) if (! in_array($ext, $this->allowed)) { return false; From 7b4f1aa9725378ccfa618aeeffb168b658aca0fc Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:32:27 +0100 Subject: [PATCH 2/3] test: add test case --- tests/Storage/Validator/FileExtTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Storage/Validator/FileExtTest.php b/tests/Storage/Validator/FileExtTest.php index b3b6a69a..e7f4f4be 100644 --- a/tests/Storage/Validator/FileExtTest.php +++ b/tests/Storage/Validator/FileExtTest.php @@ -35,5 +35,6 @@ public function testValues() $this->assertEquals($this->object->isValid('file.tar.g'), false); $this->assertEquals($this->object->isValid('file.tar.gz'), true); $this->assertEquals($this->object->isValid('file.gz'), true); + $this->assertEquals($this->object->isValid('file.GIF'), true); } } From 6f6357fc96c2bca2f9954f5fe4dc1a12094a9711 Mon Sep 17 00:00:00 2001 From: "Luke B. Silver" <22452787+loks0n@users.noreply.github.com> Date: Fri, 28 Apr 2023 11:17:34 +0100 Subject: [PATCH 3/3] fix: missing semi --- src/Storage/Validator/FileExt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storage/Validator/FileExt.php b/src/Storage/Validator/FileExt.php index 34d72288..ee121068 100644 --- a/src/Storage/Validator/FileExt.php +++ b/src/Storage/Validator/FileExt.php @@ -46,7 +46,7 @@ public function getDescription(): string public function isValid($filename): bool { $ext = pathinfo($filename, PATHINFO_EXTENSION); - $ext = strtolower($ext) + $ext = strtolower($ext); if (! in_array($ext, $this->allowed)) { return false;