asaskevich / govalidator

[Go] Package of validators and sanitizers for strings, numerics, slices and structs
MIT License
6.03k stars 555 forks source link

WinPath and UnixPath don't allow blank in the path #124

Open vvoody opened 8 years ago

vvoody commented 8 years ago

Hi. Any path having blank will fail the regex test, e.g., "/home/vux/Downloads/test something/".

WinPath        string = `^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$`
UnixPath       string = `^((?:\/[a-zA-Z0-9\.\:]+(?:_[a-zA-Z0-9\:\.]+)*(?:\-[\:a-zA-Z0-9\.]+)*)+\/?)$`
andrewwatson commented 7 years ago

seems like the easy fix is to add a matching whitespace glob to the regex in the parts that are doing alphanumeric?

sergeyglazyrindev commented 2 years ago

Hello guys! I forked this package cause owner disappeared. Hope, he will be back, but it would be easier to merge these changes back if he is back Link to my repo: create issue there and we'll discuss it.