CreateImageWizard: fix systemd validator

The naming of systemd services don't follow the RFC in the comments. See
`man systemd.unit` for the specification.
This commit is contained in:
Sanne Raymaekers 2025-02-05 11:36:28 +01:00 committed by Klara Simickova
parent 8dd85a3c1e
commit b574a7cabc

View file

@ -143,11 +143,10 @@ export const isServiceValid = (service: string) => {
return true;
}
// Restraints taken from service name syntax reference
// https://www.rfc-editor.org/rfc/rfc6335#section-5.1
// see `man systemd.unit` for the exact specification
return (
service.length <= 15 &&
/^[a-zA-Z0-9]([a-zA-Z0-9-.]*[a-zA-Z0-9])?$/.test(service) &&
service.length <= 256 &&
/^[a-zA-Z0-9]([a-zA-Z0-9.\-_:@]*[a-zA-Z0-9])?$/.test(service) &&
!/--/.test(service) && // does not contain more hyphens in a row
/[a-zA-Z]+/.test(service) // contains at least one letter
);