adopted-ember-addons / adopted-ember-addons/ember-cp-validations
add a special case for default url format validation
- Linguagem predominante
- JavaScript
- Estrelas
- 439
- Forks
- 172
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
### Environment
- Ember Version: 2.18.2
- Ember CLI Version:2.15.1
- Ember CP Validations Version:4.0.0-beta.1
### Steps to Reproduce
The default format validator for url will return false for the shortened urls from our company's tiny url generator. (eg. http://bburl/abcd), so I want to add a special case to the default url format validator.
I wonder whether you could add that special case to the default url format validator?
After I upgrade the ember-cp-validations to 4.0.0-beta.1, I find a working solution, which is to create a customized validator.
```
export default BaseValidator.extend({
validate(value) {
const result = this.test('format', value, {
type: 'url',
allowBlank: true
});
const bburl = /^(https?:\/\/bburl)/;
if (result.isValid || bburl.test(value)) {
return true;
} else {
return 'Has to be in a valid URL format';
}
}
});
```
I wonder whether you could make the change on your side, if not, what is your suggestion on this issue? Thank you!
Guia de contribuição
Direção de pesquisa
Start by locating the default URL format validator and compare its behavior with the customized validator shown in the issue. Confirm how shortened URLs such as http://bburl/abcd should be handled while preserving normal URL validation; done means the intended URLs validate successfully.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript
- Domínio
- frontend
- Tipo de issue
- Funcionalidade
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 25/100