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

URL validation incorrectly require a period in the authority

Aperta
#59 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
23
Fork
38
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.