@@ -120,10 +120,10 @@ func saveConfig(cfg iterConfig) {
120120 tomlPath := configPathTOML ()
121121 jsonPath := configPath ()
122122
123- _ , tomlExists := os .Stat (tomlPath )
124- _ , jsonExists := os .Stat (jsonPath )
123+ _ , tomlErr := os .Stat (tomlPath )
124+ _ , jsonErr := os .Stat (jsonPath )
125125
126- if tomlExists == nil || jsonExists != nil {
126+ if tomlErr == nil || jsonErr != nil {
127127 // Write TOML.
128128 if err := os .MkdirAll (filepath .Dir (tomlPath ), 0o755 ); err != nil {
129129 slog .Warn ("failed to create TOML config dir" , "err" , err )
@@ -226,7 +226,10 @@ func checkDirPermission(cfg iterConfig, filePath string) (denied bool) {
226226 }
227227 // DenyDirs: block if path is under any denied directory.
228228 for _ , d := range cfg .DenyDirs {
229- dAbs , _ := filepath .Abs (d )
229+ dAbs , err := filepath .Abs (d )
230+ if err != nil {
231+ continue
232+ }
230233 rel , err := filepath .Rel (dAbs , abs )
231234 if err == nil && ! strings .HasPrefix (rel , ".." ) {
232235 return true
@@ -235,7 +238,10 @@ func checkDirPermission(cfg iterConfig, filePath string) (denied bool) {
235238 // AllowDirs: if set, path must be under at least one allowed dir.
236239 if len (cfg .AllowDirs ) > 0 {
237240 for _ , d := range cfg .AllowDirs {
238- dAbs , _ := filepath .Abs (d )
241+ dAbs , err := filepath .Abs (d )
242+ if err != nil {
243+ continue
244+ }
239245 rel , err := filepath .Rel (dAbs , abs )
240246 if err == nil && ! strings .HasPrefix (rel , ".." ) {
241247 return false
0 commit comments