Skip to content

Commit

Permalink
[2.9] Avoid permissions errors on Windows (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonWAffel authored Nov 26, 2024
1 parent 231527b commit 112531d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/url"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -68,6 +69,13 @@ func LoadFromPath(path string) (Config, error) {
// We want this because configuration may have sensitive information (eg: creds).
// A nil error is returned if the file doesn't exist.
func GetFilePermissionWarnings(path string) ([]string, error) {
// Permission bits on Windows are not representative
// of the actual ACLs set for a given file. As the owner
// bit is always used for all three bits on Windows, this check
// will always fail, even if the file has restricted access to admins only.
if runtime.GOOS == "windows" {
return nil, nil
}
info, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
Expand Down

0 comments on commit 112531d

Please sign in to comment.