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

URL validation incorrectly require a period in the authority

オープン
#59 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
23
フォーク
38
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。