adopted-ember-addons / adopted-ember-addons/ember-validators

URL validation incorrectly require a period in the authority

Abierto
#59 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
23
Forks
38
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

In the [URL regex](https://github.com/DockYard/ember-one-way-controls\#deprecated-ember-one-way-controls):

```javascript
/(?:([A-Za-z]+):)?(\/{0,3})[a-zA-Z0-9][a-zA-Z-0-9]*(\.[\w-]+)+([\w.,@?^=%&:\/~+#-{}]*[\w@?^=%&\/~+#-{}])??/
```

the `(\.[\w-]+)+` is incorrect as it requires at least one dot in the authority, which is not a requirement of valid URLs, and prevents, for example, using `http://localhost` which is a valid URL. I think maybe changing the `\.` to a `\.?` would fix it, but rather than hacking on the existing regex, it probably makes sense to go and find a regex or library that validates URLs and doesn't exhibit this bug.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.