From 1512db5b55533d0e36516eee58a0f570c0f94250 Mon Sep 17 00:00:00 2001 From: Mariusz Kozakowski <11mariom+wordpress@gmail.com> Date: Wed, 18 Jan 2023 22:39:12 +0100 Subject: [PATCH] Fix regexp for AddedExtractor (#284) Co-authored-by: mariom <11mariom@gmail.com> --- internal/metadata/extractor_added.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/metadata/extractor_added.go b/internal/metadata/extractor_added.go index 2e9a638..a0e0d3b 100644 --- a/internal/metadata/extractor_added.go +++ b/internal/metadata/extractor_added.go @@ -14,9 +14,9 @@ func (e addedExtractor) Matches(line string) bool { } func (e addedExtractor) Extract(metadata *BackupLogMetadata, line string) { // Sample line: "Added to the repo: 0 B" - metadata.AddedSize = strings.TrimSpace(e.re.ReplaceAllString(line, "")) + metadata.AddedSize = strings.TrimSpace(e.re.ReplaceAllString(line, "$2")) } func NewAddedExtractor() MetadatExtractor { - return addedExtractor{regexp.MustCompile(`(?i)^Added to the repo:`)} + return addedExtractor{regexp.MustCompile(`(?i)^Added to the repo(sitory)?: ([\d\.]+ \w+)( \([\d\.]+[\w\s]+\))?`)} }