From e228348debccbf3be372c7616e23aa3108841d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Wed, 25 Feb 2026 21:13:30 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[equipment]=20=EC=82=AC=EC=A7=84=20URL?= =?UTF-8?q?=EC=9D=84=20Signed=20URL=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(?= =?UTF-8?q?=EB=B9=84=EA=B3=B5=EA=B0=9C=20GCS=20=EB=B2=84=ED=82=B7=20?= =?UTF-8?q?=EB=8C=80=EC=9D=91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getPhotoUrls(): 공개 URL → GoogleCloudStorageService.getSignedUrl() 사용 - basic-info 탭: 동일하게 Signed URL로 변경 - URL 유효기간 120분 --- app/Services/EquipmentPhotoService.php | 10 +++++----- .../views/equipment/partials/tabs/basic-info.blade.php | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/Services/EquipmentPhotoService.php b/app/Services/EquipmentPhotoService.php index 8867254b..c4c3c876 100644 --- a/app/Services/EquipmentPhotoService.php +++ b/app/Services/EquipmentPhotoService.php @@ -23,7 +23,8 @@ class EquipmentPhotoService private const QUALITY_STEP = 5; public function __construct( - private readonly GoogleCloudService $googleCloudService + private readonly GoogleCloudService $googleCloudService, + private readonly GoogleCloudStorageService $googleCloudStorageService, ) {} /** @@ -207,12 +208,11 @@ public function deletePhoto(Equipment $equipment, int $fileId): bool public function getPhotoUrls(Equipment $equipment): array { $photos = $equipment->photos()->get(); - $bucket = config('services.google.storage_bucket'); - return $photos->map(function ($photo) use ($bucket) { + return $photos->map(function ($photo) { $url = null; - if ($photo->gcs_object_name && $bucket) { - $url = "https://storage.googleapis.com/{$bucket}/{$photo->gcs_object_name}"; + if ($photo->gcs_object_name) { + $url = $this->googleCloudStorageService->getSignedUrl($photo->gcs_object_name, 120); } return [ diff --git a/resources/views/equipment/partials/tabs/basic-info.blade.php b/resources/views/equipment/partials/tabs/basic-info.blade.php index f32bc5cf..f0025d0f 100644 --- a/resources/views/equipment/partials/tabs/basic-info.blade.php +++ b/resources/views/equipment/partials/tabs/basic-info.blade.php @@ -91,9 +91,8 @@
@foreach($equipment->photos as $photo) @php - $bucket = config('services.google.storage_bucket'); - $url = $photo->gcs_object_name && $bucket - ? "https://storage.googleapis.com/{$bucket}/{$photo->gcs_object_name}" + $url = $photo->gcs_object_name + ? app(\App\Services\GoogleCloudStorageService::class)->getSignedUrl($photo->gcs_object_name, 120) : null; @endphp @if($url)