Fix error handling to use os.IsNotExist (#14315)

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
John
2024-08-17 05:18:16 +09:00
committed by GitHub
parent 9e9559df60
commit 9e25026519

View File

@@ -119,9 +119,7 @@ func IsValid(walletDir string) (bool, error) {
}
f, err := os.Open(expanded) // #nosec G304
if err != nil {
if strings.Contains(err.Error(), "no such file") ||
strings.Contains(err.Error(), "cannot find the file") ||
strings.Contains(err.Error(), "cannot find the path") {
if os.IsNotExist(err) {
return false, nil
}
return false, err