aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBence Ferdinandy <bence@ferdinandy.com>2024-04-13 13:39:51 +0200
committerRobin Jarry <robin@jarry.cc>2024-04-14 11:51:03 +0200
commit805a29aef9320545ec113208df5a04e454ac7fb8 (patch)
tree0de6588f7b47776539ea7b96acf821778ca6c2eb /lib
parentc70c63cbaac8bb78f7d541a2927789c3567ee0e0 (diff)
downloadaerc-805a29aef9320545ec113208df5a04e454ac7fb8.tar.gz
attach: use absolute paths instead of relative
Sometimes it is easier to change folders when adding attachments, but currently we store relative paths, which doesn't work with this. Add the absolute paths when attaching files. Replace the current user home dir with ~ to make it prettier in the UI. Implements: https://todo.sr.ht/~rjarry/aerc/134 Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/attachment.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/attachment.go b/lib/attachment.go
index a5f1b034..4dd3f41d 100644
--- a/lib/attachment.go
+++ b/lib/attachment.go
@@ -11,6 +11,7 @@ import (
"strings"
"git.sr.ht/~rjarry/aerc/lib/log"
+ "git.sr.ht/~rjarry/aerc/lib/xdg"
"github.com/emersion/go-message/mail"
"github.com/pkg/errors"
)
@@ -68,7 +69,7 @@ func (fa *FileAttachment) Name() string {
}
func (fa *FileAttachment) WriteTo(w *mail.Writer) error {
- f, err := os.Open(fa.path)
+ f, err := os.Open(xdg.ExpandHome(fa.path))
if err != nil {
return errors.Wrap(err, "os.Open")
}