Skip to content

Commit e2ef366

Browse files
committed
Fixed dependency parser
1 parent bc0e3ff commit e2ef366

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/arduino.cc/repository/libraries/db/dependencies_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@ func TestDependencyExtract(t *testing.T) {
3535
check("Arduino Uno WiFi Dev Ed Library , LoRa Node (^2.1.2)",
3636
[]string{"Arduino Uno WiFi Dev Ed Library", "LoRa Node"},
3737
[]string{"", "^2.1.2"})
38+
check("Arduino_OAuth, ArduinoHttpClient (<0.3.0), NonExistentLib",
39+
[]string{"Arduino_OAuth", "ArduinoHttpClient", "NonExistentLib"},
40+
[]string{"", "<0.3.0", ""})
3841
}

src/arduino.cc/repository/libraries/db/library.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func extractStringList(value string) []string {
4242
return res
4343
}
4444

45-
var re = regexp.MustCompile("^([a-zA-Z0-9](?:[a-zA-Z0-9._\\- ]*[a-zA-Z0-9])?)(?: \\(([^()]*)\\))?$")
45+
var re = regexp.MustCompile("^([a-zA-Z0-9](?:[a-zA-Z0-9._\\- ]*[a-zA-Z0-9])?) *(?: \\(([^()]*)\\))?$")
4646

4747
func extractDependenciesList(depends string) []*Dependency {
4848
deps := []*Dependency{}

0 commit comments

Comments
 (0)