Skip to content

Commit

Permalink
files without extensions are rejected 2
Browse files Browse the repository at this point in the history
  • Loading branch information
dnabeast committed Feb 15, 2022
1 parent ebd351d commit a162107
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/BladeImageCrop.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function fire($url, $dimensions, $offset = ['x'=>50, 'y'=>50], $format =

$url = trim($url, "/");

if ($this->fileNotFound($url)){
if ($this->fileNotImage($url)){
if (!\App::environment(['local'])) {
return 'IMAGENOTFOUND';
}
Expand All @@ -31,7 +31,7 @@ public function fire($url, $dimensions, $offset = ['x'=>50, 'y'=>50], $format =
return $newImageUrl;
}

public function fileNotFound($url){
public function fileNotImage($url){
return !Storage::disk( config('bladeimagecrop.disk') )->has($url)
|| Storage::disk( config('bladeimagecrop.disk') )->getMetadata($url)['type'] != 'file'
|| pathinfo(Storage::disk( config('bladeimagecrop.disk') )->url($url), PATHINFO_EXTENSION) === '';
Expand Down

0 comments on commit a162107

Please sign in to comment.