아이콘 처리 수정

This commit is contained in:
현성필
2025-12-12 19:24:37 +09:00
parent abb4e610af
commit 8045238448
2 changed files with 5 additions and 14 deletions
@@ -453,24 +453,19 @@ public class MyAppController {
/**
* 업로드된 앱 아이콘 파일의 유효성을 검증합니다.
* 아이콘은 선택 사항이므로 업로드된 경우에만 검증합니다.
* - 파일 크기 검증 (최대 2MB)
* - 파일 형식 검증 (PNG, JPG만 허용)
* - Magic Number 기반 실제 파일 타입 검증
*
* @param appIcon 업로드된 파일
* @param appIcon 업로드된 파일 (선택 사항)
* @param hasExistingIcon 세션에 기존 아이콘이 있는지 여부
* @param bindingResult 검증 오류를 저장할 BindingResult
*/
private void validateAppIcon(MultipartFile appIcon, boolean hasExistingIcon, BindingResult bindingResult) {
boolean hasNewUpload = appIcon != null && !appIcon.isEmpty();
// 새 업로드고 기존 아이콘도 없는 경우
if (!hasNewUpload && !hasExistingIcon) {
bindingResult.rejectValue("appIconFileName", "error.appIcon", "앱 아이콘을 선택해주세요.");
return;
}
// 새 업로드가 없으면 검증 종료 (기존 아이콘 사용)
// 아이콘은 선택 사항이므로, 새 업로드으면 검증 종료
if (!hasNewUpload) {
return;
}
@@ -89,12 +89,8 @@ public class ApiKeyRegistrationDTO implements Serializable {
// Validation helpers
public boolean isStep1Complete() {
// callbackUrl is optional, so we only check required fields
// For modifications, appIconFileId indicates an existing icon
boolean hasIcon = (appIconData != null && appIconData.length > 0)
|| (appIconFileId != null && !appIconFileId.trim().isEmpty());
return hasIcon &&
appName != null && !appName.trim().isEmpty() &&
// callbackUrl and appIcon are optional, so we only check required fields
return appName != null && !appName.trim().isEmpty() &&
appDescription != null && !appDescription.trim().isEmpty();
}