jnraine / munkiserver

Visit https://github.com/munkiserver/munkiserver for active development — this repository is no longer maintained
85 stars 27 forks source link

Updated hostname regex some more to make it more robust, hopefully. #68

Closed cengage closed 12 years ago

cengage commented 12 years ago

Strangely enough this works when importing records but now when editing an existing record it will not save when using hyphenated hostnames. I'm troubleshooting this so I would not commit this yet.

Thanks, Pepijn.

jnraine commented 12 years ago

All the headache with hostname format seems unnecessary. It seems reasonable to match using something much simpler, like /^[a-zA-Z0-9.-]+$/. Alphanumberic characters, periods, and hyphens. I can't think of a situation in which this constraint will lead to a problem.

cengage commented 12 years ago

You're right, the simplest regex possible seems to work OK. There was a lot of pattern capturing going on that I couldn't quite tell if it was being used further down the line or not. Since it sounds like it wasn't I say go with the simplest form and everyone will be happy. I have updated the regex on my server and it's working fine. I can send the pull request for it or you guys can just roll it into a next commit.