Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: 파일 이미지 확장자 소문자 가능하도록 수정 #55

Merged
merged 4 commits into from
Feb 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.listywave.image.application.domain;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.listywave.common.exception.CustomException;
import com.listywave.common.exception.ErrorCode;
import java.util.Arrays;
import lombok.AllArgsConstructor;
import lombok.Getter;

Expand All @@ -13,4 +17,12 @@ public enum ImageFileExtension {
;

private final String uploadExtension;

@JsonCreator
public static ImageFileExtension fromString(String key) {
return Arrays.stream(ImageFileExtension.values())
.filter(extensionType -> extensionType.name().equalsIgnoreCase(key))
.findFirst()
.orElseThrow(() -> new CustomException(ErrorCode.NOT_FOUND, "해당 이미지 확장자가 존재하지 않습니다."));
}
}
Loading