Browse Source

Merge branch 'V20220314' into fix-1250

tags/V1.22.3.1^2
wangjr 3 years ago
parent
commit
5249aa15aa
2 changed files with 19 additions and 13 deletions
  1. +13
    -12
      public/home/home.js
  2. +6
    -1
      routers/repo/attachment.go

+ 13
- 12
public/home/home.js View File

@@ -114,7 +114,7 @@ socket.onmessage = function (e) {
html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" +getRepotext(record) + "</a>"
}
else if(record.OpType == "9" || record.OpType == "5"){
branch = "<a href=\"" + getRepoLink(record) + "/src/branch/" + record.RefName + "\" rel=\"nofollow\">" + record.RefName + "</a>"
branch = "<a href=\"" + getRepoLink(record) + "/src/branch/" + encodeURI(record.RefName) + "\" rel=\"nofollow\">" + record.RefName + "</a>"
actionName = actionName.replace("{branch}",branch);
html += recordPrefix + actionName;
html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepotext(record) + "</a>"
@@ -152,20 +152,21 @@ socket.onmessage = function (e) {
function getTaskLink(record){
var re = getRepoLink(record);
if(record.OpType == 24){
return re + "/datasets?type=" + record.Content;
re = re + "/datasets?type=" + record.Content;
}else if(record.OpType == 25){
return re + "/cloudbrain/" + record.RefName;
re = re + "/cloudbrain/" + record.RefName;
}else if(record.OpType == 26){
return re + "/modelarts/notebook/" + record.Content;
re = re + "/modelarts/notebook/" + record.Content;
}else if(record.OpType == 27){
return re + "/modelarts/train-job/" + record.Content;
re = re + "/modelarts/train-job/" + record.Content;
}else if(record.OpType == 28){
return re + "/modelarts/inference-job/" + record.Content;
re = re + "/modelarts/inference-job/" + record.Content;
}else if(record.OpType == 29){
return re + "/cloudbrain/benchmark/" + record.RefName;
re = re + "/cloudbrain/benchmark/" + record.RefName;
}else if(record.OpType == 30){
return re + "/modelmanage/show_model_info?name=" + record.RefName;
re = re + "/modelmanage/show_model_info?name=" + record.RefName;
}
re = encodeURI(re);
return re;
}

@@ -180,7 +181,7 @@ function getMsg(record){
}
html += " <img class=\"ui avatar image\" src=\"/user/avatar/" + name + "/-1\" alt=\"\">"
html += " <div class=\"middle aligned content nowrap\">"
html += " <a href=\"/" + name + "\" title=\"\">" + name + "</a>"
html += " <a href=\"/" + encodeURI(name) + "\" title=\"\">" + name + "</a>"
return html;
}

@@ -192,7 +193,7 @@ function getRepotext(record){
}
}
function getRepoLink(record){
return record.Repo.OwnerName + "/" + record.Repo.Name;
return encodeURI(record.Repo.OwnerName + "/" + record.Repo.Name);

}

@@ -224,7 +225,7 @@ function getTime(UpdatedUnix,currentTime){
}

function getPRLink(record){
return "/" + record.Repo.OwnerName + "/" + record.Repo.Name + "/pulls/" + getIssueId(record);
return encodeURI("/" + record.Repo.OwnerName + "/" + record.Repo.Name + "/pulls/" + getIssueId(record));
}
function getPRText(record){
if(record.Repo.Alias){
@@ -237,7 +238,7 @@ function getPRText(record){

function getIssueLink(record){

return "/" + record.Repo.OwnerName + "/" + record.Repo.Name + "/issues/" + getIssueId(record);
return encodeURI("/" + record.Repo.OwnerName + "/" + record.Repo.Name + "/issues/" + getIssueId(record));
}

function getIssueId(record){


+ 6
- 1
routers/repo/attachment.go View File

@@ -512,7 +512,12 @@ func GetSuccessChunks(ctx *context.Context) {
return
}
} else {
isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + fileName)
oldFileName := fileName
oldAttachment, _ := models.GetAttachmentByUUID(fileChunk.UUID)
if oldAttachment != nil {
oldFileName = oldAttachment.Name
}
isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + oldFileName)
if err != nil {
ctx.ServerError("ObsHasObject failed", err)
return


Loading…
Cancel
Save