File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ public function extensionIsNotExcutable($excutable_extensions)
8585 throw new ExcutableFileException ();
8686 }
8787
88+ if (preg_match ('/[a-z]html/ ' , $ extension ) > 0 ) {
89+ throw new ExcutableFileException ();
90+ }
91+
8892 return $ this ;
8993 }
9094
Original file line number Diff line number Diff line change @@ -180,6 +180,18 @@ public function testFailsExtensionIsNotExcutableWithExtensionsStartsWithPhp()
180180 $ validator ->extensionIsNotExcutable (['php ' , 'html ' ]);
181181 }
182182
183+ public function testFailsExtensionIsNotExcutableWithExtensionsEndsWithHtml ()
184+ {
185+ $ uploaded_file = m::mock (UploadedFile::class);
186+ $ uploaded_file ->shouldReceive ('getClientOriginalExtension ' )->andReturn ('dhtml ' );
187+
188+ $ validator = new LfmUploadValidator ($ uploaded_file );
189+
190+ $ this ->expectException (ExcutableFileException::class);
191+
192+ $ validator ->extensionIsNotExcutable ();
193+ }
194+
183195 public function testFailsExtensionIsValidWithSpecialCharacters ()
184196 {
185197 $ uploaded_file = m::mock (UploadedFile::class);
You can’t perform that action at this time.
0 commit comments