mirror of
https://github.com/drone-plugins/drone-download.git
synced 2026-06-04 10:15:28 +08:00
fixed typo regards to sha checksumming
This commit is contained in:
@@ -57,9 +57,9 @@ func main() {
|
||||
EnvVar: "PLUGIN_MD5",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "sha265-checksum",
|
||||
Usage: "checksum in sha265 format",
|
||||
EnvVar: "PLUGIN_SHA265",
|
||||
Name: "sha256-checksum",
|
||||
Usage: "checksum in sha256 format",
|
||||
EnvVar: "PLUGIN_SHA256",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ func run(c *cli.Context) error {
|
||||
Password: c.String("password"),
|
||||
SkipVerify: c.Bool("skip-verify"),
|
||||
MD5: c.String("md5-checksum"),
|
||||
SHA265: c.String("sha265-checksum"),
|
||||
SHA256: c.String("sha256-checksum"),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ type (
|
||||
Password string
|
||||
SkipVerify bool
|
||||
MD5 string
|
||||
SHA265 string
|
||||
SHA256 string
|
||||
}
|
||||
|
||||
Plugin struct {
|
||||
@@ -121,7 +121,7 @@ func (p Plugin) Exec() error {
|
||||
}
|
||||
}
|
||||
|
||||
if p.Config.SHA265 != "" {
|
||||
if p.Config.SHA256 != "" {
|
||||
h := sha256.New()
|
||||
|
||||
if _, err := io.Copy(h, resp.Body); err != nil {
|
||||
@@ -131,7 +131,7 @@ func (p Plugin) Exec() error {
|
||||
check := fmt.Sprintf("%x", h.Sum(nil))
|
||||
|
||||
if p.Config.MD5 != check {
|
||||
return fmt.Errorf("checksum doesn't match, got %s and expected %s", check, p.Config.SHA265)
|
||||
return fmt.Errorf("checksum doesn't match, got %s and expected %s", check, p.Config.SHA256)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user