consider slashes while cleaning labels (#231)

fix prettier format check errors
This commit is contained in:
Alexander Bartsch
2022-08-16 20:28:12 +02:00
committed by GitHub
parent 01a65512ea
commit c117b29f9e
2 changed files with 10 additions and 1 deletions
+5 -1
View File
@@ -37,7 +37,11 @@ export function getWorkflowAnnotationKeyLabel(): string {
* @returns cleaned label
*/
export function cleanLabel(label: string): string {
const removedInvalidChars = label.replace(/[^-A-Za-z0-9_.]/gi, '')
let removedInvalidChars = label
.replace(/\s/gi, '_')
.replace(/[\/\\\|]/gi, '-')
.replace(/[^-A-Za-z0-9_.]/gi, '')
const regex = /([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]/
return regex.exec(removedInvalidChars)[0] || ''
}