mirror of https://github.com/portainer/portainer
fix(swarm): don't stomp on the x-registry-auth header EE-3308 (#7080)
* don't stomp on the x-registry-auth header * del header if empty json provided for registry authpull/7050/head
parent
461fc91446
commit
6d6c70a98b
|
@ -23,7 +23,7 @@ type (
|
||||||
}
|
}
|
||||||
|
|
||||||
portainerRegistryAuthenticationHeader struct {
|
portainerRegistryAuthenticationHeader struct {
|
||||||
RegistryId portainer.RegistryID `json:"registryId"`
|
RegistryId *portainer.RegistryID `json:"registryId"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,20 @@ func (transport *Transport) decorateRegistryAuthenticationHeader(request *http.R
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticationHeader, err := createRegistryAuthenticationHeader(transport.dataStore, originalHeaderData.RegistryId, accessContext)
|
// delete header and exist function without error if Front End
|
||||||
|
// passes empty json. This is to restore original behavior which
|
||||||
|
// never originally passed this header
|
||||||
|
if string(decodedHeaderData) == "{}" {
|
||||||
|
request.Header.Del("X-Registry-Auth")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// only set X-Registry-Auth if registryId is defined
|
||||||
|
if originalHeaderData.RegistryId == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
authenticationHeader, err := createRegistryAuthenticationHeader(transport.dataStore, *originalHeaderData.RegistryId, accessContext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue