From f17f4a8fbdd20c6b25c0c730b8d9ddcc756d2655 Mon Sep 17 00:00:00 2001 From: jyx-07 Date: Thu, 12 Nov 2026 14:33:00 +0900 Subject: [PATCH] =?UTF-8?q?fix(storage):=20=EC=84=A4=EC=A0=95=20=EC=98=88?= =?UTF-8?q?=EC=8B=9C=EC=97=90=20seaweedfs=20=ED=82=A4=20=EB=B0=98=EC=98=81?= =?UTF-8?q?,=20public-url=20=EB=88=84=EB=9D=BD=EC=9D=84=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=A0=84=EC=97=90=20=EA=B2=80=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit application.yaml.example이 옛 R2(spring.cloud.cloudflare) 키만 갖고 있어 seaweedfs.public-url이 빠진 설정으로 배포되면 이미지 업로드가 500으로 실패했다. (#48) Co-Authored-By: Claude Opus 5.5 --- .../server/global/storage/SeaweedUploader.kt | 4 +++- src/main/resources/application.yaml.example | 12 +++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/io/github/wntopia/gikipedia/server/global/storage/SeaweedUploader.kt b/src/main/kotlin/io/github/wntopia/gikipedia/server/global/storage/SeaweedUploader.kt index 0e3c2bb..afd4d5e 100644 --- a/src/main/kotlin/io/github/wntopia/gikipedia/server/global/storage/SeaweedUploader.kt +++ b/src/main/kotlin/io/github/wntopia/gikipedia/server/global/storage/SeaweedUploader.kt @@ -22,6 +22,8 @@ class SeaweedUploader( file: MultipartFile, keyPrefix: String, ): String { + // 설정 누락은 업로드 전에 드러내 저장소에 주인 없는 파일을 남기지 않는다. + val publicUrlBase = publicUrlBase() val key = "$keyPrefix/${UUID.randomUUID()}${extensionOf(file.originalFilename)}" try { @@ -40,7 +42,7 @@ class SeaweedUploader( throw ExpectedException("이미지 업로드에 실패했습니다.", HttpStatus.BAD_GATEWAY) } - return "${publicUrlBase()}/$key" + return "$publicUrlBase/$key" } private fun publicUrlBase(): String { diff --git a/src/main/resources/application.yaml.example b/src/main/resources/application.yaml.example index 019b88a..581669d 100644 --- a/src/main/resources/application.yaml.example +++ b/src/main/resources/application.yaml.example @@ -33,13 +33,6 @@ spring: allowed-origins: - http://localhost:3000 - http://localhost:3001 - cloud: - cloudflare: - bucket: ${R2_BUCKET:} - endpoint: ${R2_ENDPOINT:} - access-key: ${R2_ACCESS_KEY_ID:} - secret-key: ${R2_SECRET_ACCESS_KEY:} - public-url: ${R2_PUBLIC_URL:} data: mongodb: # ArticleMongoEntity.documentId의 @Indexed(unique = true)를 실제 인덱스로 만들려면 필요하다 @@ -114,3 +107,8 @@ sdk: exception: enabled: true use-english-message: false + +seaweedfs: + filer-url: ${SEAWEEDFS_FILER_URL:http://localhost:8888} + # 브라우저가 이미지를 직접 받는 외부 URL. 비어 있으면 이미지 업로드가 500으로 실패한다(#48). + public-url: ${SEAWEEDFS_PUBLIC_URL:}