Browse Source

Merge pull request '正确显示模型时间' (#751) from download-model-error into V20211115

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/751
Reviewed-by: ychao_1983 <ychao_1983@sina.com>
tags/v1.21.12.1
ychao_1983 3 years ago
parent
commit
d91dc024a8
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      modules/storage/obs.go

+ 10
- 10
modules/storage/obs.go View File

@@ -10,11 +10,11 @@ import (
"strconv"
"strings"

"github.com/unknwon/com"

"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/obs"
"code.gitea.io/gitea/modules/setting"

"github.com/unknwon/com"
)

type FileInfo struct {
@@ -185,10 +185,10 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) {
for _, val := range output.Contents {
str1 := strings.Split(val.Key, "/")
var isDir bool
var fileName,nextParentDir string
var fileName, nextParentDir string
if strings.HasSuffix(val.Key, "/") {
//dirs in next level dir
if len(str1) - len(strPrefix) > 2 {
if len(str1)-len(strPrefix) > 2 {
continue
}
fileName = str1[len(str1)-2]
@@ -199,12 +199,12 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) {
nextParentDir = parentDir + "/" + fileName
}

if fileName == strPrefix[len(strPrefix)-1] || (fileName + "/") == setting.OutPutPath {
if fileName == strPrefix[len(strPrefix)-1] || (fileName+"/") == setting.OutPutPath {
continue
}
} else {
//files in next level dir
if len(str1) - len(strPrefix) > 1 {
if len(str1)-len(strPrefix) > 1 {
continue
}
fileName = str1[len(str1)-1]
@@ -213,10 +213,10 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) {
}

fileInfo := FileInfo{
ModTime: val.LastModified.Format("2006-01-02 15:04:05"),
ModTime: val.LastModified.Local().Format("2006-01-02 15:04:05"),
FileName: fileName,
Size: val.Size,
IsDir:isDir,
Size: val.Size,
IsDir: isDir,
ParenDir: nextParentDir,
}
fileInfos = append(fileInfos, fileInfo)
@@ -257,7 +257,7 @@ func GetObsCreateSignedUrl(jobName, parentDir, fileName string) (string, error)
input := &obs.CreateSignedUrlInput{}
input.Bucket = setting.Bucket
input.Key = strings.TrimPrefix(path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, parentDir, fileName), "/")
input.Expires = 60 * 60
input.Method = obs.HttpMethodGet



Loading…
Cancel
Save