getting user; mod: avatar, profileBg, profile now working

This commit is contained in:
2026-04-19 18:27:36 +02:00
parent 61936b4576
commit f24cab8fb0
9 changed files with 390 additions and 199 deletions
+7 -3
View File
@@ -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