forked from Gitlink/gitea-1156
Merge pull request 'compare接口遵循旧版,创建文件分支名%处理' (#38) from yystopf/gitea-1156:develop into develop
This commit is contained in:
commit
c617532f47
|
@ -188,6 +188,7 @@ func GetContents(repo *models.Repository, treePath, ref string, forList bool) (*
|
|||
}
|
||||
// Handle links
|
||||
if entry.IsRegular() || entry.IsLink() {
|
||||
ref = fmt.Sprintf("%s", strings.Replace(ref, "%", "%25", -1))
|
||||
downloadURL, err := url.Parse(fmt.Sprintf("%s/raw/%s/%s/%s", repo.HTMLURL(), refType, ref, treePath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -1152,8 +1152,13 @@ func PrepareCompareDiff(
|
|||
ctx.ServerError("GetDiffRange", err)
|
||||
return false
|
||||
}
|
||||
if diff.NumFiles == 0 {
|
||||
ctx.Data["Diff"] = nil
|
||||
ctx.Data["DiffNotAvailable"] = true
|
||||
} else {
|
||||
ctx.Data["Diff"] = diff
|
||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles == 0
|
||||
ctx.Data["DiffNotAvailable"] = false
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue