Skip to content

Commit f67502d

Browse files
Fix: 유저 없이도 업로드 url 만들 수 있게 수정
Fix: 유저 없이도 업로드 url 만들 수 있게 수정
2 parents acbfccb + 1b772ed commit f67502d

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

src/main/java/project/flipnote/image/controller/ImageUploadController.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ public class ImageUploadController {
2424
//파일 업로드 API
2525
@PostMapping("/upload")
2626
public ResponseEntity<ImageUploadResponseDto> getPresignedUrl(
27-
@AuthenticationPrincipal AuthPrinciple authPrinciple,
2827
@RequestBody @Valid ImageUploadRequestDto req) {
29-
ImageUploadResponseDto res = fileService.getPresignedUrl(authPrinciple, req.fileName());
28+
ImageUploadResponseDto res = fileService.getPresignedUrl(req.fileName());
3029
return ResponseEntity.ok(res);
3130
}
3231
}

src/main/java/project/flipnote/image/service/ImageUploadService.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,8 @@ public class ImageUploadService {
3232

3333
private final S3Client s3Client;
3434
private final S3Presigner s3Presigner;
35-
private final UserProfileRepository userRepository;
3635
private static final int EXPIRE_MINUTES = 5;
3736

38-
//유저 찾기
39-
private void findUser(AuthPrinciple authPrinciple) {
40-
userRepository.findByIdAndStatus(authPrinciple.userId(), UserStatus.ACTIVE).orElseThrow(
41-
() -> new BizException(UserErrorCode.USER_NOT_FOUND)
42-
);
43-
}
44-
4537
//확장자 형식 찾기
4638
private String getContentType(String fileName) {
4739
String extension = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
@@ -56,10 +48,7 @@ private String getContentType(String fileName) {
5648
}
5749

5850
// presigned URL 생성
59-
public ImageUploadResponseDto getPresignedUrl(AuthPrinciple authPrinciple, String fileName) {
60-
61-
// 유저 찾기
62-
findUser(authPrinciple);
51+
public ImageUploadResponseDto getPresignedUrl(String fileName) {
6352

6453
// S3에 동일한 파일명이 이미 존재하는지 확인
6554
if (objectExists(fileName)) {

0 commit comments

Comments
 (0)