getting user; mod: avatar, profileBg, profile now working
This commit is contained in:
@@ -42,7 +42,11 @@ func HandleAttachmentFileUpload(response http.ResponseWriter, request *http.Requ
|
||||
defer file.Close()
|
||||
|
||||
contentType := header.Header.Get("Content-Type")
|
||||
key := minio.GetKey(conn.Id, contentType, minio.File)
|
||||
key := minio.GetKey(minio.GetKeyOptions{
|
||||
ConnectionId: conn.Id,
|
||||
MimeType: contentType,
|
||||
UploadType: minio.File,
|
||||
})
|
||||
|
||||
if err = minio.Upload(ctx, key, file, header.Size, contentType, map[string]string{
|
||||
"originalName": header.Filename,
|
||||
@@ -85,7 +89,7 @@ func HandleGetUserAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, string(minio.UserAvatarPrefix)+target.Avatar)
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, target.Avatar)
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
@@ -123,7 +127,7 @@ func HandleGetUserProfileBg(response http.ResponseWriter, request *http.Request)
|
||||
return
|
||||
}
|
||||
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, string(minio.UserProfileBgPrefix)+target.ProfileBg)
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, target.ProfileBg)
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user