Skip to content

Commit

Permalink
add user avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
ZimaOS committed Jan 11, 2024
1 parent fd925df commit 4d2b65e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions route/v1/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ func GetUserAvatar(c *gin.Context) {
return
}
user.Avatar = "/usr/share/casaos/www/avatar.svg"
if file.Exists(user.Avatar) {
c.Header("Content-Disposition", "attachment; filename*=utf-8''"+url2.PathEscape(path.Base(user.Avatar)))
c.Header("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate, value")
c.File(user.Avatar)
return
}
user.Avatar = "/var/lib/casaos/www/avatar.svg"
c.Header("Content-Disposition", "attachment; filename*=utf-8''"+url2.PathEscape(path.Base(user.Avatar)))
c.Header("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate, value")
c.File(user.Avatar)
Expand Down

0 comments on commit 4d2b65e

Please sign in to comment.