cockpit-podman icon indicating copy to clipboard operation
cockpit-podman copied to clipboard

Environment variable validation

Open jelly opened this issue 2 years ago • 1 comments

Some issues with validating env variables:

  • We allow all characters, even invalid ones. The regex should likely be [a-zA-Z_]{1,}[a-zA-Z0-9_]*
  • Empty value is allowed, but that likely makes no sense?
  • Removing an invalid entry shifts the invalidate state to the valid one, see below:

image

Then remove the top one:

image

jelly avatar Mar 15 '24 09:03 jelly

The last issue is due to the validationState being wrong compared to this.state.env

(7 entries)

[
    null,
    null,
    null,
    null,
    null,
    {
        "envKey": "Key must not be empty"
    },
    {}
]

While this.state.env is (9 entries):

[
    null,
    null,
    null,
    null,
    null,
    null,
    {
        "key": 6,
        "envKey": null,
        "envValue": null
    },
    {
        "key": 7,
        "envKey": null,
        "envValue": null
    },
    {
        "key": 8,
        "envKey": "jijij",
        "envValue": null
    }
]

While the UI shows:

image

jelly avatar Mar 15 '24 12:03 jelly