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

URL validation incorrectly require a period in the authority

未關閉
#59 0 則留言 0 個 reaction 已指派 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 摘要。