From ec68f1a27f0d5bb7f5fb4bc19c6342e622463753 Mon Sep 17 00:00:00 2001 From: Mark Benjamin Date: Tue, 12 Nov 2024 18:22:02 -0800 Subject: [PATCH] chmod directory if it doesn't have correct permissions --- pkg/config/config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index e406d85..f992280 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -131,6 +131,11 @@ func Load() (*Config, error) { return nil, err } + err = os.Chmod(filepath.Dir(path), 0755) + if err != nil { + return nil, err + } + data, err := os.ReadFile(path) if err != nil { if os.IsNotExist(err) { @@ -159,6 +164,11 @@ func (c *Config) Persist() error { return err } + err = os.Chmod(filepath.Dir(path), 0755) + if err != nil { + return err + } + err = os.MkdirAll(filepath.Dir(path), 0755) if err != nil { return err