Skip to content

Commit

Permalink
hotfix: 이미지 저장 오류
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Aug 24, 2024
1 parent bb3c2f5 commit 4991e7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.whopper.application.file.impl;

import com.example.whopper.infrastructure.aws.s3.AwsS3Properties;
import io.awspring.cloud.s3.S3Operations;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
Expand All @@ -8,8 +9,9 @@
@RequiredArgsConstructor
class FileDeleteService {
private final S3Operations s3Operations;
private final AwsS3Properties s3Properties;

void deleteByUrl(String url) {
s3Operations.deleteObject(url);
void deleteByKey(String key) {
s3Operations.deleteObject(s3Properties.bucket(), key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public String getFileBaseUrl() {

@Override
public void deleteImage(String url) {
fileDeleteService.deleteByUrl(url);
final var key = url.substring(awsS3Properties.url().length());

fileDeleteService.deleteByKey(key);
}

private String getExtension(String filename) {
Expand Down

0 comments on commit 4991e7b

Please sign in to comment.