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

🐛 유저 디폴트 이미지가 삭제되는 버그 수정 #184

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
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
Expand Up @@ -169,6 +169,9 @@ public void updateMemberPreferCategory(Member member, MemberRequestDto.changeCat
@Override
@Transactional
public String updateMemberProfileImage(Member member, MemberRequestDto.changeProfileDto profileDto) throws IOException {
if (!member.getProfileUrl().equals(defaultProfileImage)) {
s3Manager.deleteFile(toKeyName(member.getProfileUrl()).substring(1));
}
Uuid uuid = s3Manager.createUUID();
String KeyName = s3Manager.generateMemberKeyName(uuid);
String fileUrl = s3Manager.uploadFile(KeyName, profileDto.getNewProfile());
Expand Down Expand Up @@ -457,6 +460,9 @@ public static String toKeyName(String imageUrl) {
@Override
@Transactional
public void updateProfileDefault(Member member) {
if (member.getProfileUrl().equals(defaultProfileImage)) {
return;
}
s3Manager.deleteFile(toKeyName(member.getProfileUrl()).substring(1));
member.setProfileUrl(defaultProfileImage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ public ResponseDto<MemberResponseDto.MemberStatusDto> updateCaption(@AuthMember
})
public ResponseDto<MemberResponseDto.MemberStatusDto> updateProfileDefault(@AuthMember Member member) {
memberService.updateProfileDefault(member);

return ResponseDto.of(MemberConverter.toMemberStatusDto(member.getMemberId(), "UpdateProfileDefault"));
}

Expand Down
Loading