mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 15:20:56 +00:00
upnp: Use a separate error for the error unmarshalling
Previously, when unmarshing the SOAP error code data we would overwrite the original err, typically with null since the parsing of the error code information succeeds. If we don't have a upnp 725 error, we would fall back to returning null or no error. This broke our upnp error handling logic for AddPortMappings as it would think it succeeds if it gets a 718 permission error.
This commit is contained in:
parent
80aaf6a065
commit
5bdf4c6143
@ -531,9 +531,9 @@ func (s *IGDService) AddPortMapping(localIPAddress string, protocol Protocol, ex
|
||||
if err != nil && timeout > 0 {
|
||||
// Try to repair error code 725 - OnlyPermanentLeasesSupported
|
||||
envelope := &soapErrorResponse{}
|
||||
err = xml.Unmarshal(response, envelope)
|
||||
if err != nil {
|
||||
return err
|
||||
err2 := xml.Unmarshal(response, envelope)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
if envelope.ErrorCode == 725 {
|
||||
return s.AddPortMapping(localIPAddress, protocol, externalPort, internalPort, description, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user