Skip to content

Commit 7c716c5

Browse files
committed
[Release] 4.8.7
1 parent a6c2dfe commit 7c716c5

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [4.8.7] 6/16/2024
2+
3+
**Updating** Potential fixes for certain windows users during automatic updating.
4+
15
## [4.8.6] 6/16/2024
26

37
**Spire Admin** Fix issue under unauthenticated local installations where websocket connections would get caught in an authorization loop, spamming the console. Unauthenticated Spire installations will now work properly.

internal/updater/updater.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package updater
33
import (
44
"bufio"
55
"context"
6+
"crypto/md5"
67
"encoding/json"
78
"fmt"
89
"github.com/Akkadius/spire/internal/download"
@@ -177,19 +178,23 @@ func (s *Updater) CheckForUpdates(interactive bool) bool {
177178
Msg("Checking asset")
178179

179180
if assetName == targetFileNameZipped {
181+
hash := fmt.Sprintf("%x", md5.Sum([]byte(downloadUrl)))
182+
tmpdir := filepath.Join(os.TempDir(), "spire-update", hash)
183+
_ = os.MkdirAll(tmpdir, os.ModePerm)
184+
180185
s.logger.Info().Any("assetName", assetName).Msg("Found matching release")
181186

182187
// download
183188
file := path.Base(downloadUrl)
184-
downloadPath := filepath.Join(os.TempDir(), file)
189+
downloadPath := filepath.Join(tmpdir, file)
185190
err := download.WithProgress(downloadPath, downloadUrl)
186191
if err != nil {
187192
s.logger.Fatal().Err(err).Msg("Failed to download asset")
188193
}
189194

190195
// unzip
191-
tempFileZipped := filepath.Join(os.TempDir(), targetFileNameZipped)
192-
err = s.unzipper.Extract(tempFileZipped, os.TempDir())
196+
tempFileZipped := filepath.Join(tmpdir, targetFileNameZipped)
197+
err = s.unzipper.Extract(tempFileZipped, tmpdir)
193198
if err != nil {
194199
s.logger.Fatal().Err(err).Msg("Failed to extract zip")
195200
}
@@ -204,7 +209,7 @@ func (s *Updater) CheckForUpdates(interactive bool) bool {
204209
}
205210

206211
// relink
207-
lookTempFile := filepath.Join(os.TempDir(), targetFileName)
212+
lookTempFile := filepath.Join(tmpdir, targetFileName)
208213
tempFile, err := exec.LookPath(lookTempFile)
209214
if err != nil {
210215
s.logger.Fatal().Err(err).Msg("Failed to find executable")

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "spire",
3-
"version": "4.8.6",
3+
"version": "4.8.7",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/Akkadius/spire.git"

0 commit comments

Comments
 (0)