Fix empty version in download with buildInVersion fallback

This commit is contained in:
Florian Brinker 2019-11-13 12:59:43 +01:00
parent 4a3d5c25e1
commit d2fa5f5ce0

View File

@ -2,10 +2,11 @@ package main
import ( import (
"fmt" "fmt"
"github.com/drone-plugins/drone-hugo/download"
"os" "os"
"os/exec" "os/exec"
"strings" "strings"
"github.com/drone-plugins/drone-hugo/download"
) )
type ( type (
@ -41,7 +42,12 @@ func (p Plugin) Exec() error {
// Check if buildIn plugin version equals // Check if buildIn plugin version equals
// plugin version declared in drone.yml // plugin version declared in drone.yml
if !versionsEqual(p.BuildInVersion, p.Config.HugoVersion, p.Config.HugoExtended) { if !versionsEqual(p.BuildInVersion, p.Config.HugoVersion, p.Config.HugoExtended) {
hugoPath, err := download.Get(p.Config.HugoVersion, p.Config.HugoExtended) hugoVersion := p.Config.HugoVersion
if hugoVersion == "" {
hugoVersion = p.BuildInVersion
}
hugoPath, err := download.Get(hugoVersion, p.Config.HugoExtended)
if err != nil { if err != nil {
return err return err
} }