mirror of
https://github.com/KaySar12/NextZen-UserService.git
synced 2025-10-06 19:59:42 +07:00
update avatar
This commit is contained in:
+4
-6
@@ -222,16 +222,14 @@ func GetUserAvatar(c *gin.Context) {
|
||||
}
|
||||
|
||||
if file.Exists(user.Avatar) {
|
||||
// @tiger - RESTful 规范下不应该返回文件本身内容,而是返回文件的静态URL,由前端去解析
|
||||
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
|
||||
}
|
||||
c.JSON(http.StatusNotFound,
|
||||
model.Result{
|
||||
Success: common_err.SERVICE_ERROR,
|
||||
Message: user.Avatar + " not found",
|
||||
})
|
||||
user.Avatar = "/usr/share/casaos/www/avatar.svg"
|
||||
c.Header("Content-Disposition", "attachment; filename*=utf-8''"+url2.PathEscape(path.Base(user.Avatar)))
|
||||
c.File(user.Avatar)
|
||||
}
|
||||
|
||||
// @Summary edit user name
|
||||
|
||||
Reference in New Issue
Block a user