selfupdate: obey --no-check-certificate flag

This patch makes sure we use our own HTTP transport when fetching the
current rclone version.

This allows it to use --no-check-certificate (and any other features
of our own transport).

See: https://forum.rclone.org/t/rclone-selfupdate-no-check-certificate-flag-not-work/37501
This commit is contained in:
Nick Craig-Wood
2023-04-11 10:22:18 +01:00
parent e82db0b7d5
commit 4471e6f258
2 changed files with 11 additions and 7 deletions

View File

@@ -68,13 +68,14 @@ var cmdSelfUpdate = &cobra.Command{
"versionIntroduced": "v1.55",
},
Run: func(command *cobra.Command, args []string) {
ctx := context.Background()
cmd.CheckArgs(0, 0, command, args)
if Opt.Package == "" {
Opt.Package = "zip"
}
gotActionFlags := Opt.Stable || Opt.Beta || Opt.Output != "" || Opt.Version != "" || Opt.Package != "zip"
if Opt.Check && !gotActionFlags {
versionCmd.CheckVersion()
versionCmd.CheckVersion(ctx)
return
}
if Opt.Package != "zip" {
@@ -108,7 +109,7 @@ func GetVersion(ctx context.Context, beta bool, version string) (newVersion, sit
if version == "" {
// Request the latest release number from the download site
_, newVersion, _, err = versionCmd.GetVersion(siteURL + "/version.txt")
_, newVersion, _, err = versionCmd.GetVersion(ctx, siteURL+"/version.txt")
return
}