Commit 0272cf84 authored by duanjinfei's avatar duanjinfei

add oss content type return

parent 24ace5c1
......@@ -6,7 +6,8 @@ const (
MinerSign = "miner"
ReqHash = "reqHash"
RespHash = "respHash"
ResultFileExpiresDB = "ResultFileExpiresDB"
ResultFileExpiresDB = "expires"
ContentType = "type"
RedirectCode = 303
UseFileCache = "USE-FILE-CACHE"
)
......@@ -242,8 +242,9 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
}
if len(containerResp.Output) == 1 {
if utils.IsBase64ImageStr(containerResp.Output[0]) {
imageStr := strings.SplitN(containerResp.Output[0], ",", 2)[1]
queryString := utils.MatchFileCacheQueryString(taskParam.Headers, taskCmd.ImageName, t.DockerOp.ModelsInfo)
containerRespOutput := strings.SplitN(containerResp.Output[0], ",", 2)
imageStr := containerRespOutput[1]
queryString := utils.MatchFileCacheQueryString(taskParam.Headers, taskCmd.ImageName, t.DockerOp.ModelsInfo, containerRespOutput[0])
//ossUri, err := t.uploadOSS(taskMsg.TaskId, queryString, containerResp.Output[0])
ossUri, err := t.uploadOSS(taskMsg.TaskId, queryString, imageStr)
if err != nil {
......
......@@ -103,7 +103,7 @@ func IsBase64ImageStr(imageStr string) bool {
return err == nil
}
func MatchFileCacheQueryString(params map[string][]string, taskImageName string, modelsInfo []*models.ModelInfo) string {
func MatchFileCacheQueryString(params map[string][]string, taskImageName string, modelsInfo []*models.ModelInfo, formatType string) string {
values := url.Values{}
isExistFileExpires := false
for key, value := range params {
......@@ -126,6 +126,8 @@ func MatchFileCacheQueryString(params map[string][]string, taskImageName string,
if !isModelExistFileExpires {
values.Add(models.ResultFileExpiresDB, "600")
}
contentType := strings.Split(strings.Split(formatType, ";")[0], ":")[1]
values.Add(models.ContentType, contentType)
return values.Encode()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment