From f2999c8c3dec9adf17880e19bc22081606666619 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 8 Mar 2022 10:35:59 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=A6=81=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/public/home/home.js b/public/home/home.js index 78b9d517c..c0082382a 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -114,7 +114,7 @@ socket.onmessage = function (e) { html += " " +getRepotext(record) + "" } else if(record.OpType == "9" || record.OpType == "5"){ - branch = "" + record.RefName + "" + branch = "" + record.RefName + "" actionName = actionName.replace("{branch}",branch); html += recordPrefix + actionName; html += " " + getRepotext(record) + "" @@ -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 += " \"\"" html += "
" - html += " " + name + "" + html += " " + name + "" 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,20 +225,20 @@ 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){ - return record.Repo.OwnerName + "/" + record.Repo.Alias + "#" + getIssueId(record); + return encodeURI(record.Repo.OwnerName + "/" + record.Repo.Alias + "#" + getIssueId(record)); }else{ - return record.Repo.OwnerName + "/" + record.Repo.Name + "#" + getIssueId(record); + return encodeURI(record.Repo.OwnerName + "/" + record.Repo.Name + "#" + getIssueId(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){ From c21449fb3237ddd3cde215d5ce2689a2d7efef58 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 8 Mar 2022 10:37:46 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=A6=81=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/home/home.js b/public/home/home.js index c0082382a..227f5b496 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -229,9 +229,9 @@ function getPRLink(record){ } function getPRText(record){ if(record.Repo.Alias){ - return encodeURI(record.Repo.OwnerName + "/" + record.Repo.Alias + "#" + getIssueId(record)); + return record.Repo.OwnerName + "/" + record.Repo.Alias + "#" + getIssueId(record); }else{ - return encodeURI(record.Repo.OwnerName + "/" + record.Repo.Name + "#" + getIssueId(record)); + return record.Repo.OwnerName + "/" + record.Repo.Name + "#" + getIssueId(record); } } From 79e9f0da10f61dbf0c600eba4048941adcccc355 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Tue, 8 Mar 2022 11:11:48 +0800 Subject: [PATCH 3/4] #1352 fix bug --- routers/repo/attachment.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index bc843c555..9de16ba2d 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -512,6 +512,10 @@ func GetSuccessChunks(ctx *context.Context) { return } } else { + oldAttachment, _ := models.GetAttachmentByUUID(fileChunk.UUID) + if oldAttachment != nil { + fileName = oldAttachment.Name + } isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + fileName) if err != nil { ctx.ServerError("ObsHasObject failed", err) From 281cafaa9f0bfbf3989269d19c625dd8f54f3a41 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Tue, 8 Mar 2022 11:25:10 +0800 Subject: [PATCH 4/4] #1352 fix bug --- routers/repo/attachment.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 9de16ba2d..668169110 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -512,11 +512,12 @@ func GetSuccessChunks(ctx *context.Context) { return } } else { + oldFileName := fileName oldAttachment, _ := models.GetAttachmentByUUID(fileChunk.UUID) if oldAttachment != nil { - fileName = oldAttachment.Name + oldFileName = oldAttachment.Name } - isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + fileName) + isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + oldFileName) if err != nil { ctx.ServerError("ObsHasObject failed", err) return