From a4deb8b8e0d908d18370fcafb9e8cebfa2a144cb Mon Sep 17 00:00:00 2001 From: HyoBN Date: Wed, 11 Oct 2023 23:33:19 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20=EC=9C=A0=EC=A0=80=20=EB=94=94=ED=8F=B4?= =?UTF-8?q?=ED=8A=B8=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EA=B0=80=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/service/serviceImpl/MemberServiceImpl.java | 6 ++++++ .../server/web/controller/MemberRestController.java | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java b/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java index d934275..e763b04 100644 --- a/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java +++ b/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java @@ -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()); @@ -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); } diff --git a/src/main/java/zipdabang/server/web/controller/MemberRestController.java b/src/main/java/zipdabang/server/web/controller/MemberRestController.java index 900850d..679916f 100644 --- a/src/main/java/zipdabang/server/web/controller/MemberRestController.java +++ b/src/main/java/zipdabang/server/web/controller/MemberRestController.java @@ -485,7 +485,6 @@ public ResponseDto updateCaption(@AuthMember }) public ResponseDto updateProfileDefault(@AuthMember Member member) { memberService.updateProfileDefault(member); - return ResponseDto.of(MemberConverter.toMemberStatusDto(member.getMemberId(), "UpdateProfileDefault")); }