Skip to content

Bug in File Search #1988

@rishavch2104

Description

@rishavch2104

Preflight Checklist

  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I am not looking for support or already pursued the available support channels without success.
  • I have checked the troubleshooting guide for my problem, without success.

Viper Version

1.19.0

Go Version

1.23.5

Config Source

Flags

Format

YAML

Repl.it link

No response

Code reproducing the issue

viper.SetConfigName("testfile")
viper.SetConfigType("yaml")
viper.AddConfigPath("/dir/dir2/testfile")

Expected Behavior

When searching if file exists, file path should only be searched with list of available extension and custom extension if provided in config.

Actual Behavior

In line 86 in file.go , extension is not added while checking exists so incorrect files will be matched.

Steps To Reproduce

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions