Skip to content

Commit 460d0d9

Browse files
lafrikslunny
authored andcommitted
Fix go-get, src and raw urls to new scheme (#2978) (#2986)
1 parent 9c07d90 commit 460d0d9

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
@@ -250,11 +250,11 @@ func Diff(ctx *context.Context) {
250250
ctx.Data["Diff"] = diff
251251
ctx.Data["Parents"] = parents
252252
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
253-
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", commitID)
253+
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", commitID)
254254
if commit.ParentCount() > 0 {
255-
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", parents[0])
255+
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", parents[0])
256256
}
257-
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", commitID)
257+
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", "commit", commitID)
258258
ctx.HTML(200, tplDiff)
259259
}
260260

@@ -315,9 +315,9 @@ func CompareDiff(ctx *context.Context) {
315315
ctx.Data["Commit"] = commit
316316
ctx.Data["Diff"] = diff
317317
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
318-
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", afterCommitID)
319-
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", beforeCommitID)
320-
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", afterCommitID)
318+
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", afterCommitID)
319+
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", beforeCommitID)
320+
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", "commit", afterCommitID)
321321
ctx.Data["RequireHighlightJS"] = true
322322
ctx.HTML(200, tplDiff)
323323
}

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)