test: BannerService/S3Service 단위 테스트 추가 + 이미지 업로드 크래시 버그 수정 (prod) - #225
Merged
Conversation
BannerService 2개, S3Service.uploadImage 7개, 총 9개 신규 테스트. 테스트 작성 중 발견해서 수정한 버그 (S3Service.getFileExtension): 1. 파일명이 null이면 length() 호출에서 NPE → 500. null/빈 문자열 체크 추가. 2. 파일명에 "."가 없으면 lastIndexOf가 -1을 반환하고 그 값 그대로 substring(-1)을 호출해 StringIndexOutOfBoundsException → 500. "."가 없는 경우를 먼저 걸러내도록 수정. 둘 다 원래는 "잘못된 이미지 파일입니다"(400/404)로 처리됐어야 할 케이스가 서버 에러로 새어나가고 있었음. ## 별도로 확인만 하고 고치지 않은 것 S3Service.deleteFile()의 `imageUrl.substring(49)`는 폴더명/버킷명 길이에 따라 늘 달라지는 값이라 하드코딩된 49는 구조적으로 항상 맞을 수 없음. 다만 이 메서드를 실제로 호출하는 곳이 코드베이스 전체에 없어(dead code) 지금 당장 영향은 없음. 실제 URL 포맷을 확인 없이 숫자만 바꾸는 건 오히려 위험해서, 이번엔 고치지 않고 플래그만 해둠 — deleteFile을 실제로 쓰기 전에 반드시 점검 필요.
unam98
requested review from
RinRinPARK,
YuSuhwa-ve and
funnysunny08
as code owners
August 5, 2026 11:44
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
작업 배경
변경 사항
S3Service.getFileExtensionBannerServiceTest,S3ServiceTest영향 범위
deleteFile()의 하드코딩된 오프셋 문제는 dev PR #224와 동일하게 이번에도 손대지 않음 (실사용 없는 dead code, 검증 없이 고치는 게 더 위험).검증 매트릭스
dev PR #224와 동일한 테스트 파일 —
S3ServiceTest,BannerServiceTest참고.Test Plan
docker run으로 임시 DB/Redis 띄워서./gradlew build전체(ServerApplicationTests 포함) 통과 확인🤖 Generated with Claude Code