A free open source IT asset/license management system
Pint
snipe156d25bed71b
diff --git a/app/Http/Requests/ImageUploadRequest.php b/app/Http/Requests/ImageUploadRequest.phpindex 9c851a5859..d3516b1f18 100644--- a/app/Http/Requests/ImageUploadRequest.php+++ b/app/Http/Requests/ImageUploadRequest.php@@ -95,9 +95,9 @@ class ImageUploadRequest extends Request// never HEAD an empty key (which S3's HeadObject validator rejects// outright — the bug behind #18267).$path = trim((string) $path, '/');- $prefix = $path === '' ? '' : $path . '/';+ $prefix = $path === '' ? '' : $path.'/';- if ($path !== '' && !Storage::disk('public')->exists($path)) {+ if ($path !== '' && ! Storage::disk('public')->exists($path)) {Storage::disk('public')->makeDirectory($path);}@@ -115,7 +115,7 @@ class ImageUploadRequest extends Requestif (($image->getMimeType() == 'image/vnd.microsoft.icon') || ($image->getMimeType() == 'image/x-icon') || ($image->getMimeType() == 'image/avif') || ($image->getMimeType() == 'image/webp')) {// If the file is an icon, webp or avif, we need to just move it since gd doesn't support resizing// icons or avif, and webp support and needs to be compiled into gd for resizing to be available- Storage::disk('public')->put($prefix . $file_name, file_get_contents($image));+ Storage::disk('public')->put($prefix.$file_name, file_get_contents($image));} elseif ($image->getMimeType() == 'image/svg+xml') {// If the file is an SVG, we need to clean it and NOT encode it@@ -124,7 +124,7 @@ class ImageUploadRequest extends Request$cleanSVG = $sanitizer->sanitize($dirtySVG);try {- Storage::disk('public')->put($prefix . $file_name, $cleanSVG);+ Storage::disk('public')->put($prefix.$file_name, $cleanSVG);} catch (\Exception $e) {Log::debug($e);}@@ -145,7 +145,7 @@ class ImageUploadRequest extends Request}// This requires a string instead of an object, so we use ($string)- Storage::disk('public')->put($prefix . $file_name, (string) $upload->encode());+ Storage::disk('public')->put($prefix.$file_name, (string) $upload->encode());}@@ -170,7 +170,7 @@ class ImageUploadRequest extends Request// pass '' for the disk root, and we don't want to produce a// leading-slash key on S3.$path = trim((string) $path, '/');- $key = $path === '' ? $item->{$db_fieldname} : $path . '/' . $item->{$db_fieldname};+ $key = $path === '' ? $item->{$db_fieldname} : $path.'/'.$item->{$db_fieldname};Storage::disk('public')->delete($key);$item->{$db_fieldname} = null;} catch (\Exception $e) {diff --git a/tests/Feature/Settings/BrandingSettingsTest.php b/tests/Feature/Settings/BrandingSettingsTest.phpindex df6229df83..1731dcc631 100644--- a/tests/Feature/Settings/BrandingSettingsTest.php+++ b/tests/Feature/Settings/BrandingSettingsTest.php@@ -135,10 +135,10 @@ class BrandingSettingsTest extends TestCase$proxy = \Mockery::mock($publicDisk);$proxy->shouldReceive('exists')->with('')->never();- $proxy->shouldReceive('exists')->andReturnUsing(fn($p) => $publicDisk->exists($p));- $proxy->shouldReceive('put')->andReturnUsing(fn(...$a) => $publicDisk->put(...$a));- $proxy->shouldReceive('delete')->andReturnUsing(fn(...$a) => $publicDisk->delete(...$a));- $proxy->shouldReceive('makeDirectory')->andReturnUsing(fn(...$a) => $publicDisk->makeDirectory(...$a));+ $proxy->shouldReceive('exists')->andReturnUsing(fn ($p) => $publicDisk->exists($p));+ $proxy->shouldReceive('put')->andReturnUsing(fn (...$a) => $publicDisk->put(...$a));+ $proxy->shouldReceive('delete')->andReturnUsing(fn (...$a) => $publicDisk->delete(...$a));+ $proxy->shouldReceive('makeDirectory')->andReturnUsing(fn (...$a) => $publicDisk->makeDirectory(...$a));Storage::shouldReceive('disk')->with('public')->andReturn($proxy);$this->actingAs(User::factory()->superuser()->create())