File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/main/kotlin/site/billilge/api/backend/global/external/s3 Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,17 @@ class S3Service(
1717 @Value(" \$ {cloud.aws.s3.bucket}" )
1818 val bucket : String ,
1919 @Value(" \$ {cloud.aws.s3.base-url}" )
20- val baseUrl : String
20+ val baseUrl : String ,
21+ @Value(" \$ {spring.profiles.active}" )
22+ val activeProfile : String ,
2123) {
2224 fun uploadImageFile (imageFile : MultipartFile , newFileName : String = "items/${UUID .randomUUID()}"): String? {
2325 val originalName = imageFile.originalFilename ? : return null
2426
27+
2528 val ext = originalName.substring(originalName.lastIndexOf(" ." ))
26- val changedName = newFileName + ext
29+ val fileNameByProfile = if (activeProfile == " dev" ) " dev/${newFileName} " else newFileName
30+ val changedName = fileNameByProfile + ext
2731
2832 val metadata = ObjectMetadata ().apply {
2933 contentType = imageFile.contentType
You can’t perform that action at this time.
0 commit comments