Validation webhooks
Closed
Validation webhooks
Created by: joren
The validation on web hooks doesn't really does his job. It only ignores url's that don't start with http or https. But when the url is tested or actually called it failes because URI.parse fails.
I'm not sure what the preferred change is. I could change URI.regexp() with a better regex, use a custom validator or something like http://www.simonecarletti.com/code/publicsuffix/. I'm not really familiar with the style guide of the development but would like to help.
I added 3 test of url's that should fail because it would not be able to be parsed when the webhook gets called.
Failures:
1) ProjectHook Validations url format
Failure/Error: it { should_not allow_value("http://ex_ample.com").for(:url) }
Expected errors when url is set to "http://ex_ample.com", got no errors
# ./spec/models/web_hook_spec.rb:38:in `block (4 levels) in <top (required)>'
2) ProjectHook Validations url format
Failure/Error: it { should_not allow_value("http://example").for(:url) }
Expected errors when url is set to "http://example", got no errors
# ./spec/models/web_hook_spec.rb:39:in `block (4 levels) in <top (required)>'
3) ProjectHook Validations url format
Failure/Error: it { should_not allow_value("http://ex ample").for(:url) }
Expected errors when url is set to "http://ex ample", got no errors
# ./spec/models/web_hook_spec.rb:40:in `block (4 levels) in <top (required)>'
Created by: senny
I'm closing this one as it is more a question / feature request than a bug report.
If you are interested to work on GitLab and improve the validations it would be much appreciated! You can start by reading the contribution guidelines. Then just work on a simple sample implementation to make your desired changes and open a Pull Request. Feel free to ping me if you have further questions.
By Administrator on 2013-05-19T06:59:40 (imported from GitLab project)