Browse Source

strings.TrimLeft is not actually TrimPrefix

Jakob Borg 10 years ago
parent
commit
e6866ee980
1 changed files with 1 additions and 1 deletions
  1. 1 1
      internal/upnp/upnp.go

+ 1 - 1
internal/upnp/upnp.go

@@ -255,7 +255,7 @@ func parseResponse(deviceType string, resp []byte) (IGD, error) {
 		return IGD{}, errors.New("invalid IGD response: USN not specified")
 	}
 
-	deviceUUID := strings.TrimLeft(strings.Split(deviceUSN, "::")[0], "uuid:")
+	deviceUUID := strings.TrimPrefix(strings.Split(deviceUSN, "::")[0], "uuid:")
 	matched, err := regexp.MatchString("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", deviceUUID)
 	if !matched {
 		l.Infoln("Invalid IGD response: invalid device UUID", deviceUUID, "(continuing anyway)")