diff --git a/cmd/droned/drone.go b/cmd/droned/drone.go index 215d0f276..ede6cfe86 100644 --- a/cmd/droned/drone.go +++ b/cmd/droned/drone.go @@ -222,9 +222,9 @@ func setupHandlers() { m.Post("/install", handler.ErrorHandler(handler.InstallPost)) // handlers for repository, commits and build details - m.Get("/:host/:owner/:name/commit/:branch/:commit/build/:label/out.txt", handler.RepoHandler(handler.BuildOut)) - m.Get("/:host/:owner/:name/commit/:branch/:commit/build/:label", handler.RepoHandler(handler.CommitShow)) - m.Get("/:host/:owner/:name/commit/:branch/:commit", handler.RepoHandler(handler.CommitShow)) + m.Get("/:host/:owner/:name/commit/:commit/build/:label/out.txt", handler.RepoHandler(handler.BuildOut)) + m.Get("/:host/:owner/:name/commit/:commit/build/:label", handler.RepoHandler(handler.CommitShow)) + m.Get("/:host/:owner/:name/commit/:commit", handler.RepoHandler(handler.CommitShow)) m.Get("/:host/:owner/:name/tree", handler.RepoHandler(handler.RepoDashboard)) m.Get("/:host/:owner/:name/status.svg", handler.ErrorHandler(handler.Badge)) m.Get("/:host/:owner/:name/settings", handler.RepoAdminHandler(handler.RepoSettingsForm)) diff --git a/pkg/handler/builds.go b/pkg/handler/builds.go index 982cf8cc6..be524a411 100644 --- a/pkg/handler/builds.go +++ b/pkg/handler/builds.go @@ -9,7 +9,11 @@ import ( // Returns the combined stdout / stderr for an individual Build. func BuildOut(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error { - branch := r.FormValue(":branch") + branch := r.FormValue("branch") + if branch == "" { + branch = "master" + } + hash := r.FormValue(":commit") labl := r.FormValue(":label") diff --git a/pkg/handler/commits.go b/pkg/handler/commits.go index ec81b7874..39ed0d7d9 100644 --- a/pkg/handler/commits.go +++ b/pkg/handler/commits.go @@ -11,7 +11,11 @@ import ( // Display a specific Commit. func CommitShow(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error { - branch := r.FormValue(":branch") + branch := r.FormValue("branch") + if branch == "" { + branch = "master" + } + hash := r.FormValue(":commit") labl := r.FormValue(":label") diff --git a/pkg/template/emails/failure.html b/pkg/template/emails/failure.html index 25e4488f0..2a7f7478e 100644 --- a/pkg/template/emails/failure.html +++ b/pkg/template/emails/failure.html @@ -10,7 +10,7 @@ - + diff --git a/pkg/template/emails/success.html b/pkg/template/emails/success.html index 522358f10..7933d8201 100644 --- a/pkg/template/emails/success.html +++ b/pkg/template/emails/success.html @@ -10,7 +10,7 @@
commit:{{ .Commit.HashShort }}{{ .Commit.HashShort }}
branch:
- + diff --git a/pkg/template/pages/repo_commit.html b/pkg/template/pages/repo_commit.html index 262e9cafb..2dfd38b34 100644 --- a/pkg/template/pages/repo_commit.html +++ b/pkg/template/pages/repo_commit.html @@ -5,7 +5,7 @@
@@ -18,7 +18,7 @@
- + {{ if .Commit.PullRequest }} opened pull request # {{ .Commit.PullRequest }} {{ else }} @@ -78,7 +78,7 @@ }); {{ else }} - $.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt", function( data ) { + $.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt?branch={{ .Commit.Branch }}", function( data ) { var lineFormatter = new Drone.LineFormatter(); $( "#stdout" ).html(lineFormatter.format(data)); }); diff --git a/pkg/template/pages/repo_dashboard.html b/pkg/template/pages/repo_dashboard.html index c027cc0f2..c7819d7c3 100644 --- a/pkg/template/pages/repo_dashboard.html +++ b/pkg/template/pages/repo_dashboard.html @@ -28,12 +28,12 @@
commit:{{ .Commit.HashShort }}{{ .Commit.HashShort }}
branch: