|
|
|
@@ -360,6 +360,7 @@ func GetPresignedPutObjectURL(ctx *context.Context) { |
|
|
|
// AddAttachment response for add attachment record |
|
|
|
func AddAttachment(ctx *context.Context) { |
|
|
|
typeCloudBrain := ctx.QueryInt("type") |
|
|
|
fileName := ctx.Query("file_name") |
|
|
|
err := checkTypeCloudBrain(typeCloudBrain) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("checkTypeCloudBrain failed", err) |
|
|
|
@@ -375,7 +376,7 @@ func AddAttachment(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
has, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(uuid) + "/" + uuid) |
|
|
|
has, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(uuid) + "/" + fileName) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("ObsHasObject", err) |
|
|
|
return |
|
|
|
@@ -391,7 +392,7 @@ func AddAttachment(ctx *context.Context) { |
|
|
|
UUID: uuid, |
|
|
|
UploaderID: ctx.User.ID, |
|
|
|
IsPrivate: true, |
|
|
|
Name: ctx.Query("file_name"), |
|
|
|
Name: fileName, |
|
|
|
Size: ctx.QueryInt64("size"), |
|
|
|
DatasetID: ctx.QueryInt64("dataset_id"), |
|
|
|
Type: typeCloudBrain, |
|
|
|
@@ -479,6 +480,7 @@ func UpdateAttachmentDecompressState(ctx *context.Context) { |
|
|
|
func GetSuccessChunks(ctx *context.Context) { |
|
|
|
fileMD5 := ctx.Query("md5") |
|
|
|
typeCloudBrain := ctx.QueryInt("type") |
|
|
|
fileName := ctx.Query("file_name") |
|
|
|
var chunks string |
|
|
|
|
|
|
|
err := checkTypeCloudBrain(typeCloudBrain) |
|
|
|
@@ -510,7 +512,7 @@ func GetSuccessChunks(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + fileChunk.UUID) |
|
|
|
isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + fileName) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("ObsHasObject failed", err) |
|
|
|
return |
|
|
|
|