style: use interpolated medias/{$filename} paths

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Paulo Castellano 2026-07-23 11:21:52 -03:00
parent 2ba5ce2b3f
commit 66dbf438ee
3 changed files with 8 additions and 5 deletions

View file

@ -120,7 +120,7 @@ public function storeFromUrl(StoreAssetFromUrlRequest $request, UnsplashService
};
$filename = Str::uuid().'.'.$extension;
$path = 'medias/'.$filename;
$path = "medias/{$filename}";
Storage::put($path, $response->body());

View file

@ -88,7 +88,7 @@ public function addMedia(UploadedFile $file, string $collection = 'default', arr
);
$filename = Str::uuid().'.'.$normalizedExt;
$path = 'medias/'.$filename;
$path = "medias/{$filename}";
Storage::put($path, $normalizedBytes);
@ -128,14 +128,16 @@ public function addMediaFromPath(string $filePath, string $originalFilename, str
);
$size = strlen($bytes);
$mediaMeta = array_merge($this->getMediaMetaFromBytes($bytes, $type, $meta), $meta);
$storagePath = 'medias/'.Str::uuid().'.'.$storedExt;
$filename = Str::uuid().".{$storedExt}";
$storagePath = "medias/{$filename}";
Storage::put($storagePath, $bytes);
} else {
$storedMime = $mimeType;
$storedExt = $extension;
$size = (int) filesize($filePath);
$mediaMeta = $meta;
$storagePath = 'medias/'.Str::uuid().'.'.$storedExt;
$filename = Str::uuid().".{$storedExt}";
$storagePath = "medias/{$filename}";
$stream = fopen($filePath, 'rb');
if ($stream === false) {

View file

@ -176,7 +176,8 @@ private function status(array $state, int $totalSize, bool $completed): array
private function startUpload(string $fileName, string $firstChunk): array
{
$extension = strtolower((string) pathinfo($fileName, PATHINFO_EXTENSION));
$key = 'medias/'.Str::uuid().'.'.$extension;
$filename = Str::uuid().".{$extension}";
$key = "medias/{$filename}";
$mimeType = $this->detectMimeType($firstChunk, $extension);
$created = $this->s3()->createMultipartUpload([