mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
fix(be): checking build version by nil
This commit is contained in:
parent
a68c64cbaa
commit
f5ad81f7c0
@ -90,7 +90,7 @@ func AddTaskToPool(d db.Store, taskObj db.Task, userID *int, projectID int) (new
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if len(builds) == 0 {
|
||||
if len(builds) == 0 || builds[0].Version == nil {
|
||||
taskObj.Version = tpl.StartVersion
|
||||
} else {
|
||||
v := getNextBuildVersion(*tpl.StartVersion, *builds[0].Version)
|
||||
@ -180,7 +180,7 @@ func GetAllTasks(w http.ResponseWriter, r *http.Request) {
|
||||
func GetLastTasks(w http.ResponseWriter, r *http.Request) {
|
||||
str := r.URL.Query().Get("limit")
|
||||
limit, err := strconv.Atoi(str)
|
||||
if err != nil || limit <= 0 || limit > 200 {
|
||||
if err != nil || limit <= 0 || limit > 200 {
|
||||
limit = 200
|
||||
}
|
||||
GetTasksList(w, r, uint64(limit))
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -75,7 +76,9 @@ func doUpgrade() error {
|
||||
// findAsset returns the binary for this platform.
|
||||
func findAsset(release *github.RepositoryRelease) *github.ReleaseAsset {
|
||||
for _, asset := range release.Assets {
|
||||
if *asset.Name == fmt.Sprintf("semaphore_%s_%s", runtime.GOOS, runtime.GOARCH) {
|
||||
suffix := fmt.Sprintf("_%s_%s.tar.gz", runtime.GOOS, runtime.GOARCH)
|
||||
if strings.HasPrefix(*asset.Name, "semaphore_") &&
|
||||
strings.HasSuffix(*asset.Name, suffix) {
|
||||
return &asset
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user