|
|
|
@@ -11,7 +11,6 @@ import ( |
|
|
|
"fmt" |
|
|
|
"mime/multipart" |
|
|
|
"net/http" |
|
|
|
"path" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
|
|
|
|
@@ -830,20 +829,6 @@ func GetMultipartUploadUrl(ctx *context.Context) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func GetObsKey(ctx *context.Context) { |
|
|
|
uuid := gouuid.NewV4().String() |
|
|
|
key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") |
|
|
|
|
|
|
|
ctx.JSON(200, map[string]string{ |
|
|
|
"uuid": uuid, |
|
|
|
"key": key, |
|
|
|
"access_key_id": setting.AccessKeyID, |
|
|
|
"secret_access_key": setting.SecretAccessKey, |
|
|
|
"server": setting.Endpoint, |
|
|
|
"bucket": setting.Bucket, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func CompleteMultipart(ctx *context.Context) { |
|
|
|
uuid := ctx.Query("uuid") |
|
|
|
uploadID := ctx.Query("uploadID") |
|
|
|
@@ -947,34 +932,6 @@ func CompleteMultipart(ctx *context.Context) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func UpdateMultipart(ctx *context.Context) { |
|
|
|
uuid := ctx.Query("uuid") |
|
|
|
partNumber := ctx.QueryInt("chunkNumber") |
|
|
|
etag := ctx.Query("etag") |
|
|
|
|
|
|
|
fileChunk, err := models.GetFileChunkByUUID(uuid) |
|
|
|
if err != nil { |
|
|
|
if models.IsErrFileChunkNotExist(err) { |
|
|
|
ctx.Error(404) |
|
|
|
} else { |
|
|
|
ctx.ServerError("GetFileChunkByUUID", err) |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
fileChunk.CompletedParts = append(fileChunk.CompletedParts, strconv.Itoa(partNumber)+"-"+strings.Replace(etag, "\"", "", -1)) |
|
|
|
|
|
|
|
err = models.UpdateFileChunk(fileChunk) |
|
|
|
if err != nil { |
|
|
|
ctx.Error(500, fmt.Sprintf("UpdateFileChunk: %v", err)) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
ctx.JSON(200, map[string]string{ |
|
|
|
"result_code": "0", |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func HandleUnDecompressAttachment() { |
|
|
|
attachs, err := models.GetUnDecompressAttachments() |
|
|
|
if err != nil { |
|
|
|
|