Skip to content

Commit

Permalink
throw on filesystem errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed May 4, 2024
1 parent fd2d9e3 commit 8252a9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions app/Images/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Images\Exceptions\OriginalDoesNotExist;
use Carbon\Carbon;
use Exception;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Http\File as LaravelFile;
Expand Down Expand Up @@ -51,9 +50,7 @@ public static function store(LaravelFile|UploadedFile|string $file, array $attri

$path = static::disk()->putFile(static::uploadPath(), $file, 'private');

if ($path === false) {
throw new Exception('Failed to safe a file.');
}
assert(is_string($path));

/** @var static */
return tap(
Expand Down
8 changes: 4 additions & 4 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
'throw' => true,
],

'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
'throw' => false,
'throw' => true,
],

'media' => [
Expand All @@ -28,7 +28,7 @@
'bucket' => env('S3_BUCKET_MEDIA'),
'endpoint' => env('S3_ENDPOINT'),
'use_path_style_endpoint' => false,
'throw' => false,
'throw' => true,
],

'backup' => [
Expand All @@ -39,7 +39,7 @@
'bucket' => env('S3_BUCKET_BACKUP'),
'endpoint' => env('S3_ENDPOINT'),
'use_path_style_endpoint' => false,
'throw' => false,
'throw' => true,
],

],
Expand Down

0 comments on commit 8252a9d

Please sign in to comment.