Skip to content

Commit 6e83a43

Browse files
committed
fix dependency parse regex
1 parent ed877da commit 6e83a43

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

.env

Whitespace-only changes.

core/installer/utils.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func EnsureDependencyOfArgs(pkg *models.Package, args []string) {
1313
dependency := ParseDependency(args[e])
1414
dependency = strings.ToLower(dependency)
1515

16-
re := regexp.MustCompile(`(?m)(?:(?P<host>.*)(?::(?P<version>[\^~]?(?:(?:(?:[0-9]+)(?:\.[0-9]+)(?:\.[0-9]+)?))))$|(?P<host_only>.*))`)
16+
re := regexp.MustCompile(`(?U)(?m)^(?:http[s]{0,1}://)?(?P<host>.*)(?::(?P<version>[\^~]?(?:\d+\.)?(?:\d+\.)?(?:\*|\d+)))?$`)
1717
match := make(map[string]string)
1818
split := re.FindStringSubmatch(dependency)
1919

@@ -24,12 +24,11 @@ func EnsureDependencyOfArgs(pkg *models.Package, args []string) {
2424
}
2525
var ver string
2626
var dep string
27+
dep = match["host"]
2728
if len(match["version"]) == 0 {
2829
ver = consts.MinimalDependencyVersion
29-
dep = match["host_only"]
3030
} else {
3131
ver = match["version"]
32-
dep = match["host"]
3332
}
3433

3534
if strings.HasSuffix(strings.ToLower(dep), ".git") {

0 commit comments

Comments
 (0)