Skip to content

Commit

Permalink
fix GlobToRegex for slash suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
Son Roy Almerol committed Dec 16, 2024
1 parent 1ac8caa commit eb7fa9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/backend/backup/jobrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func RunBackup(job *store.Job, storeInstance *store.Store, waitChan chan struct{
formattedTime := time.Now().Format(time.RFC3339)

select {
case <-logCtx.Done():
case <-ctx.Done():
if !taskHasError {
_, err := writer.WriteString(formattedTime + ": TASK OK\n")
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions internal/utils/pattern_regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ func GlobToRegex(glob string) (string, error) {
glob = glob[1:]
}

glob = strings.TrimSuffix(glob, "/")
glob = strings.TrimSuffix(glob, "\\")

var regex strings.Builder
regex.WriteString(".*") // Match any path leading to the pattern

Expand Down

0 comments on commit eb7fa9f

Please sign in to comment.