From abfd01cc74101cf905ab064260554bdc9769444f Mon Sep 17 00:00:00 2001 From: Stephan Hradek Date: Fri, 10 Jun 2022 06:13:22 +0200 Subject: [PATCH] fix issue 177 (#200) --- pkg/mark/attachment.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/mark/attachment.go b/pkg/mark/attachment.go index b67efd5..b639734 100644 --- a/pkg/mark/attachment.go +++ b/pkg/mark/attachment.go @@ -42,16 +42,16 @@ func ResolveAttachments( return nil, err } - for _, attach := range attaches { - checksum, err := getChecksum(attach.Path) + for i, _ := range attaches { + checksum, err := getChecksum(attaches[i].Path) if err != nil { return nil, karma.Format( err, - "unable to get checksum for attachment: %q", attach.Name, + "unable to get checksum for attachment: %q", attaches[i].Name, ) } - attach.Checksum = checksum + attaches[i].Checksum = checksum } remotes, err := api.GetAttachments(page.ID) @@ -147,6 +147,10 @@ func ResolveAttachments( updating[i] = attach } + for i, _ := range existing { + log.Infof(nil, "keeping unmodified attachment: %q", attaches[i].Name) + } + attaches = []Attachment{} attaches = append(attaches, existing...) attaches = append(attaches, creating...)