Skip to content

Commit

Permalink
update UpdatePhotoProfile.go 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fchrgrib committed Jun 16, 2023
1 parent d0cc4b5 commit a098395
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions controllers/profile/UpdatePhotoProfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ func UpdatePhotoProfile(c *gin.Context, router *gin.RouterGroup) {
return
}

if err := os.Remove(photoProfileUser.Path); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"status": err,
})
return
if photoProfileUser.Path != "" {
if err := os.Remove(photoProfileUser.Path); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"status": err,
})
return
}
}

if err := c.ShouldBind(&photoProfileUpload); err != nil {
Expand Down

3 comments on commit a098395

@vercel
Copy link

@vercel vercel bot commented on a098395 Jun 16, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on a098395 Jun 16, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on a098395 Jun 16, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.