Better validation of the sitePath
Today, there was a problem with a specific webeossite
whose spec looked like the following
spec:
...
sitePath: /eos/user/j/jpacalt/www/
type: ownerProvidedEosFolder
The leading slash in the sitePath
caused an error which is then reported here https://gitlab.cern.ch/webservices/webeos/webeos-config-operator/-/blob/master/pkg/controller/webeosconfig/webeossite_validator.go#L54
Apparently sanitize.Path
removes leading slashes and this is why the if
fails. This IMO shouldn't fail because the paths are the same and are valid.
So to summarize, this is the code that was executed (pseudo-code to better explain it):
if "/eos/user/j/jpacalt/www" != "/eos/user/j/jpacalt/www/" {
errorList = append(errorList, fmt.Errorf("This SitePath is not valid path: '%v'", webeossite.SitePath))
}
Edited by Michal Kolodziejski