Skip to content

Commit 7cbc5a4

Browse files
committed
Fix go-get, src and raw urls to new scheme
1 parent fb5c6b6 commit 7cbc5a4

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

modules/context/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func Contexter() macaron.Handler {
182182
branchName = repo.DefaultBranch
183183
}
184184
}
185-
prefix := setting.AppURL + path.Join(ownerName, repoName, "src", branchName)
185+
prefix := setting.AppURL + path.Join(ownerName, repoName, "src", "branch", branchName)
186186
c.PlainText(http.StatusOK, []byte(com.Expand(`
187187
<html>
188188
<head>

modules/context/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ func RepoAssignment() macaron.Handler {
453453

454454
if ctx.Query("go-get") == "1" {
455455
ctx.Data["GoGetImport"] = ComposeGoGetImport(owner.Name, repo.Name)
456-
prefix := setting.AppURL + path.Join(owner.Name, repo.Name, "src", ctx.Repo.BranchName)
456+
prefix := setting.AppURL + path.Join(owner.Name, repo.Name, "src", "branch", ctx.Repo.BranchName)
457457
ctx.Data["GoDocDirectory"] = prefix + "{/dir}"
458458
ctx.Data["GoDocFile"] = prefix + "{/dir}/{file}#L{line}"
459459
}

routers/repo/commit.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ func Diff(ctx *context.Context) {
237237
ctx.Data["Diff"] = diff
238238
ctx.Data["Parents"] = parents
239239
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
240-
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", commitID)
240+
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", commitID)
241241
if commit.ParentCount() > 0 {
242-
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", parents[0])
242+
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", parents[0])
243243
}
244-
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", commitID)
244+
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", "commit", commitID)
245245
ctx.HTML(200, tplDiff)
246246
}
247247

@@ -302,9 +302,9 @@ func CompareDiff(ctx *context.Context) {
302302
ctx.Data["Commit"] = commit
303303
ctx.Data["Diff"] = diff
304304
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
305-
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", afterCommitID)
306-
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", beforeCommitID)
307-
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", afterCommitID)
305+
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", afterCommitID)
306+
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", beforeCommitID)
307+
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", "commit", afterCommitID)
308308
ctx.Data["RequireHighlightJS"] = true
309309
ctx.HTML(200, tplDiff)
310310
}

routers/repo/pull.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,9 @@ func ViewPullFiles(ctx *context.Context) {
480480
}
481481

482482
ctx.Data["IsImageFile"] = commit.IsImageFile
483-
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", endCommitID)
484-
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", startCommitID)
485-
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", endCommitID)
483+
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", endCommitID)
484+
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", startCommitID)
485+
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", "commit", endCommitID)
486486
ctx.Data["RequireHighlightJS"] = true
487487

488488
ctx.HTML(200, tplPullFiles)
@@ -689,9 +689,9 @@ func PrepareCompareDiff(
689689
ctx.Data["IsImageFile"] = headCommit.IsImageFile
690690

691691
headTarget := path.Join(headUser.Name, repo.Name)
692-
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", headCommitID)
693-
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
694-
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", headCommitID)
692+
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", headCommitID)
693+
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", prInfo.MergeBase)
694+
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", "commit", headCommitID)
695695
return false
696696
}
697697

routers/repo/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func Search(ctx *context.Context) {
3838
pager := paginater.New(total, setting.UI.RepoSearchPagingNum, page, 5)
3939
ctx.Data["Page"] = pager
4040
ctx.Data["SourcePath"] = setting.AppSubURL + "/" +
41-
path.Join(ctx.Repo.Repository.Owner.Name, ctx.Repo.Repository.Name, "src", ctx.Repo.Repository.DefaultBranch)
41+
path.Join(ctx.Repo.Repository.Owner.Name, ctx.Repo.Repository.Name, "src", "branch", ctx.Repo.Repository.DefaultBranch)
4242
ctx.Data["SearchResults"] = searchResults
4343
ctx.Data["RequireHighlightJS"] = true
4444
ctx.Data["PageIsViewCode"] = true

0 commit comments

Comments
 (0)