Skip to content

Commit

Permalink
refactor!: avoid trimming www in domain name (#99)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: www subdomain is taken into account if it comes to domain name
  • Loading branch information
mercs600 committed Oct 22, 2021
1 parent 3fa8db9 commit 0b4cc78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/templates/lib/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ function isDynamicRoute (route) {
* @param {String} url
*/
function getHostByURL (url) {
const match = url.match(/^(http:\/\/|https:\/\/)?(www[0-9]?.)?([^/:]*).*$/)
const match = url.match(/^(http:\/\/|https:\/\/)?([^/:]*).*$/)
if (
match != null &&
match.length > 2 &&
typeof match[3] === 'string' &&
match[3].length > 0
typeof match[2] === 'string' &&
match[2].length > 0
) {
return match[3]
return match[2]
} else {
return null
}
Expand Down

0 comments on commit 0b4cc78

Please sign in to comment.