Skip to content

Commit

Permalink
Handle multi-word network names
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-koch committed Mar 2, 2024
1 parent f4c3d66 commit 51964ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions service/wlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ func getWlanNetwork(device string) (string, error) {
logger.Error(fmt.Sprintf("Failed to get network airport network: %v", err))
return "", err
} else {
networkRe := regexp.MustCompile("Current\\s+Wi-Fi\\s+Network:\\s+(?P<network>\\S+)")
lines := strings.Split(string(output), "\n")
networkRe := regexp.MustCompile("Current\\s+Wi-Fi\\s+Network:\\s+(?P<network>.+)\\s*")
outputStr := string(output)
lines := strings.Split(outputStr, "\n")
for _, line := range lines {
networkMatch := utils.MatchNamedExpression(networkRe, line)
if networkMatch != nil {
Expand Down

0 comments on commit 51964ce

Please sign in to comment.