Skip to content

Commit

Permalink
Merge pull request #330 from nxgcx/fix/storage-disk-exists-check
Browse files Browse the repository at this point in the history
Fix: `time()` being appended regardless of pre-existing file with same filename
  • Loading branch information
awcodes authored Oct 25, 2023
2 parents 69eb6cc + 86fdab5 commit ce1da3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Components/Forms/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function setUp(): void

$filename = $component->shouldPreserveFilenames()
? Str::of(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME))->slug()
: Str::uuid();
: (string)Str::uuid();

$extension = $file->getClientOriginalExtension();

Expand All @@ -117,7 +117,7 @@ protected function setUp(): void
$exif = $image->exif();
}

if ($file->exists()) {
if (Storage::disk($component->getDiskName())->exists(ltrim($component->getDirectory().'/'.$filename.'.'.$extension, '/'))) {
$filename = $filename . '-' . time();
}

Expand Down

0 comments on commit ce1da3b

Please sign in to comment.