Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: filepath doesn't work as expected #1389

Closed
DevKhaverko opened this issue Feb 25, 2025 · 2 comments
Closed

[Bug]: filepath doesn't work as expected #1389

DevKhaverko opened this issue Feb 25, 2025 · 2 comments
Labels

Comments

@DevKhaverko
Copy link

What happened?

I used filepath tag with * in path, and library hadn't reported error about wrong path, because syscall.ENOENT not checked in tag function

Version

1.25

Example Code

ConfigPath string `validate:"omitempty,filepath"`

value was nonexisting file /path/not/exist/*
@DevKhaverko
Copy link
Author

PR for fixing this problem #1388

@zemzale
Copy link
Member

zemzale commented Feb 25, 2025

if you wish to check existence of file use the file validator. filepath doesn't support checking file existence

Links to docs:
https://pkg.go.dev/github.com/go-playground/validator/v10#hdr-File
https://pkg.go.dev/github.com/go-playground/validator/v10#hdr-File_Path

@zemzale zemzale closed this as completed Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants