Recently a HTTP form password field changed and is disabled unless user explicitly sets the password. From the HTML forms nature, if user does not specify any value in the text field, server receives the value as an empty string. If the field is disabled, there's no value sent and the server keeps that attribute as nil.
After the mentioned change, if user does not set any of username and password, we end up in a situation where username is empty string and password is nil. This causes problems at some backend services, namely Pulp 2.
We should either keep both as empty strings or both as nils. The later seems more universal, since it's consistent with the API behavior in case user does not specify the values. Therefore we make sure the value is nilified if it's an empty string.
Related issues
Bug #31637: Repository enable failed on http-proxy configured setup.
Fixes #31637 - nilify http proxy credentials
Recently a HTTP form password field changed and is disabled unless user
explicitly sets the password. From the HTML forms nature, if user does
not specify any value in the text field, server receives the value as an
empty string. If the field is disabled, there's no value sent and the
server keeps that attribute as nil.
After the mentioned change, if user does not set any of username and
password, we end up in a situation where username is empty string and
password is nil. This causes problems at some backend services, namely
Pulp 2.
We should either keep both as empty strings or both as nils. The later
seems more universal, since it's consistent with the API behavior in
case user does not specify the values. Therefore we make sure the value
is nilified if it's an empty string.