From 22649b8b68b589e97db1470d5a902e3a6a66c404 Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Fri, 28 Apr 2023 17:19:08 -0400 Subject: [PATCH] Attachments map now maps filenames to full files --- attachments.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/attachments.go b/attachments.go index fda483f..3ffd92f 100644 --- a/attachments.go +++ b/attachments.go @@ -16,7 +16,7 @@ func NewAttachmentMover() *AttachmentMover { var am AttachmentMover l, _ := zap.NewProduction() am.L = l - am.Attachments = make(map[string]bool) + am.Attachments = make(map[string]string) am.Posts = make([]string, 0) return &am @@ -82,9 +82,9 @@ func (am *AttachmentMover) findAttachments(path string, d fs.DirEntry, err error walkLogger.Info("found attachment file, adding to index") absPath, err := filepath.Abs(filepath.Join(am.Source, path)) if err != nil { - return fmt.Errorf("error generating absolute path for attachment %q: %w", err) + return fmt.Errorf("error generating absolute path for attachment %q: %w", path, err) } - am.Attachments[filename] = absPath + am.Attachments[filepath.Base(absPath)] = absPath } return nil }