From 367b96df0f003e1e75db44e4f859bee7541d7007 Mon Sep 17 00:00:00 2001 From: Gykes <24581046+Gykes@users.noreply.github.com> Date: Mon, 17 Nov 2025 20:06:25 -0800 Subject: [PATCH] Bug Fix: Update Macos Version Check (#6289) --- internal/api/check_version.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/internal/api/check_version.go b/internal/api/check_version.go index 6279997d7..f4c2950f1 100644 --- a/internal/api/check_version.go +++ b/internal/api/check_version.go @@ -7,8 +7,10 @@ import ( "fmt" "io" "net/http" + "os" "regexp" "runtime" + "strings" "time" "golang.org/x/sys/cpu" @@ -36,6 +38,24 @@ var stashReleases = func() map[string]string { } } +// isMacOSBundle checks if the application is running from within a macOS .app bundle +func isMacOSBundle() bool { + exec, err := os.Executable() + return err == nil && strings.Contains(exec, "Stash.app/") +} + +// getWantedRelease determines which release variant to download based on platform and bundle type +func getWantedRelease(platform string) string { + release := stashReleases()[platform] + + // On macOS, check if running from .app bundle + if runtime.GOOS == "darwin" && isMacOSBundle() { + return "Stash.app.zip" + } + + return release +} + type githubReleasesResponse struct { Url string Assets_url string @@ -168,7 +188,7 @@ func GetLatestRelease(ctx context.Context) (*LatestRelease, error) { } platform := fmt.Sprintf("%s/%s", runtime.GOOS, arch) - wantedRelease := stashReleases()[platform] + wantedRelease := getWantedRelease(platform) url := apiReleases if build.IsDevelop() {