|
|
|
@@ -17,6 +17,8 @@ import ( |
|
|
|
"code.gitea.io/gitea/modules/upload" |
|
|
|
) |
|
|
|
|
|
|
|
const MINIO_STORAGE_TYPE = "minio" |
|
|
|
|
|
|
|
func RenderAttachmentSettings(ctx *context.Context) { |
|
|
|
renderAttachmentSettings(ctx) |
|
|
|
} |
|
|
|
@@ -127,8 +129,26 @@ func GetAttachment(ctx *context.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dataSet, err := attach.LinkedDataSet() |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("LinkedDataSet", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if dataSet != nil { |
|
|
|
isPermit, err := models.GetUserDataSetPermission(dataSet, ctx.User) |
|
|
|
if err != nil { |
|
|
|
ctx.Error(http.StatusInternalServerError, "GetUserDataSetPermission", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
if !isPermit { |
|
|
|
ctx.Error(http.StatusNotFound) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//If we have matched and access to release or issue |
|
|
|
if setting.Attachment.StoreType == "minio" { |
|
|
|
if setting.Attachment.StoreType == MINIO_STORAGE_TYPE { |
|
|
|
url, err := storage.Attachments.PresignedGetURL(attach.RelativePath(), attach.Name) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("PresignedGetURL", err) |
|
|
|
|