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

URL validation incorrectly require a period in the authority

Offen
#59 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
23
Forks
38
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.