Fix characteres on filenames not allowed on resources v2

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
This commit is contained in:
Alexandre Peixoto Ferreira 2022-07-18 13:33:38 -05:00
parent fe9b26d283
commit d65b7208db
No known key found for this signature in database
GPG Key ID: 9BDC9DE410CFC23B
10 changed files with 25 additions and 10 deletions

17
main.go
View File

@ -93,7 +93,22 @@ func readDevDirectory(dirToList string, allowedRecursions uint8) (files []string
}
func sanitizeName(path string) string {
return strings.Replace(path, "/!@#$%^&*()[]{}'`~.", "___________________",-1)
sanitizeChar := func(r rune) rune {
switch {
case r >= 'A' && r <= 'Z':
return r
case r >= 'a' && r <= 'z':
return r
case r >= '0' && r <= '9':
return r
case r == '_':
return r
case r == '-':
return r
}
return '_'
}
return strings.Map(sanitizeChar, path)
}
func findDevicesPattern(listDevices []string, pattern string) ([]string,error) {

View File

@ -15,7 +15,7 @@ spec:
nodeName: smarter-jetson-xavier-4bcc2584
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -15,7 +15,7 @@ spec:
nodeName: <replace with node to run>
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -15,7 +15,7 @@ spec:
nodeName: <replace with node to run>
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -34,7 +34,7 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -34,7 +34,7 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -34,7 +34,7 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -34,7 +34,7 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -34,7 +34,7 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View File

@ -34,7 +34,7 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: smarter-device-manager
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.8
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.20.10
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false