2 Commits

Author SHA1 Message Date
05bc31aa90 Trim regex to work with yaml pipe 2025-04-01 12:17:42 +02:00
81d69b8ce0 Force always /
Fuck windows and its path fuck windows
2025-04-01 12:15:03 +02:00
2 changed files with 8 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ func ProcessRegex(content string, command utils.ModifyCommand, filename string)
// We don't HAVE to do this multiple times for a pattern // We don't HAVE to do this multiple times for a pattern
// But it's quick enough for us to not care // But it's quick enough for us to not care
pattern := resolveRegexPlaceholders(command.Regex) pattern := resolveRegexPlaceholders(command.Regex)
// I'm not too happy about having to trim regex, we could have meaningful whitespace or newlines
// But it's a compromise that allows us to use | in yaml
// Otherwise we would have to escape every god damn pair of quotation marks
// And a bunch of other shit
pattern = strings.TrimSpace(pattern)
logger.Debug("Compiling regex pattern: %s", pattern) logger.Debug("Compiling regex pattern: %s", pattern)
patternCompileStart := time.Now() patternCompileStart := time.Now()

View File

@@ -206,6 +206,9 @@ func ExpandGLobs(patterns map[string]struct{}) ([]string, error) {
logger.Debug("Found %d matches for pattern %s", len(matches), pattern) logger.Debug("Found %d matches for pattern %s", len(matches), pattern)
for _, m := range matches { for _, m := range matches {
m = filepath.Join(root, m) m = filepath.Join(root, m)
m = filepath.Clean(m)
m = strings.ReplaceAll(m, "\\", "/")
info, err := os.Stat(m) info, err := os.Stat(m)
if err != nil { if err != nil {
logger.Warning("Error getting file info for %s: %v", m, err) logger.Warning("Error getting file info for %s: %v", m, err)