Skip to content

feat: file system#18

Open
Ze-rith wants to merge 3 commits intodevelopfrom
16-feature-file
Open

feat: file system#18
Ze-rith wants to merge 3 commits intodevelopfrom
16-feature-file

Conversation

@Ze-rith
Copy link
Copy Markdown

@Ze-rith Ze-rith commented Apr 16, 2026

작업내용

  • 파일 업로드
  • 사진 업로드

관련 이슈

#16

Jira 기능 링크(선택)

https://team-23d.atlassian.net/browse/KAN-33

확인사항

  • 코드스타일이 컨밴션을 따르는지 확인하셨나요?
  • 모든 코드가 정상적으로 동작하는지 확인하셨나요?

@Ze-rith Ze-rith requested review from L98293 and abcb-s April 17, 2026 00:45
Comment thread src/main/java/spring/springserver/global/config/SecurityConfig.java Outdated
Comment thread src/main/java/spring/springserver/domain/file/data/request/FileUploadRequest.java Outdated
Comment thread src/main/java/spring/springserver/global/config/WebConfig.java
Comment thread src/main/java/spring/springserver/global/config/WebConfig.java
Comment thread src/main/java/spring/springserver/global/config/WebConfig.java
Comment on lines +22 to +24
public BaseResponse<ImageUploadResponse> uploadImage(

@ModelAttribute @Valid final ImageUploadRequest imageUploadRequest) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public BaseResponse uploadImage(@ModelAttribute @Valid final ImageUploadRequest imageUploadRequest) {

이렇게 줄바꿈 제거 해주시길 바랍니다.

Comment on lines +9 to +11
public static FileUploadResponse of(
String file_url,
String message) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    public static FileUploadResponse of(String file_url, 
                                        String message) {

이렇게 수정 바랍니다.

Image


String message
) {
public static FileUploadResponse of(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

줄바꿈 후 작성 바랍니다.

@Getter
@RequiredArgsConstructor
public enum FileStatusCode implements StatusCode {
FILE_EMPTY("FILE_EMPTY", "업로드할 파일이 비어 있습니다.", HttpStatus.BAD_REQUEST),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

줄바꿈 바랍니다.

MultipartFile multipartFile = fileUploadRequest.multipartFile();

if (multipartFile == null || multipartFile.isEmpty()) {
throw new ApplicationException(FileStatusCode.FILE_EMPTY);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

줄바꿈 바랍니다.

}

try {
Path uploadPath = Path.of(fileDirectory).toAbsolutePath().normalize();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

줄바꿈 바랍니다

String storedFileName = UUID.randomUUID() + "_" + originalFilename;
Path targetPath = uploadPath.resolve(storedFileName);

Files.copy(multipartFile.getInputStream(), targetPath, StandardCopyOption.REPLACE_EXISTING);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 부분은 파일 경로에 대한 검증이 없으며, 악성 스크립트 파일이 업로드 될 수 있는 심각한 보안 취약점이 발생할 수 있으니 빠른 수정 바랍니다.

}

try {
Path uploadPath = Path.of(imageDirectory).toAbsolutePath().normalize();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

줄바꿈 바랍니다

private static final List<String> ALLOWED_CONTENT_TYPES = List.of(
"image/jpeg",
"image/png",
"image/gif",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gif는 삭제바랍니다.

Comment on lines +70 to +71
"/files/*",
"/images/*",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 두개는 Swagger관련이 아니므로 따로 빼 주시길 바랍니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants