aboutsummaryrefslogtreecommitdiffstats
path: root/worker/maildir/worker.go
diff options
context:
space:
mode:
authorBence Ferdinandy <bence@ferdinandy.com>2024-01-26 21:42:30 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-26 22:14:39 +0100
commit1a129a21239abf188d2ea78b46e832e6266739b7 (patch)
tree6a90b8dcb2fb6dcb464183a2891aafb9228799ef /worker/maildir/worker.go
parent161768eb7371b4844dfdfac56ce090a0f0091ff1 (diff)
downloadaerc-1a129a21239abf188d2ea78b46e832e6266739b7.tar.gz
maildir: show valid messages even if there are errors
When go-maildir parses a folder and finds an error, it will still return the valid keys it has found along with the error. Instead of returning an empty list of UIDs log an error and proceed with the valid uids found by go-maildir. When opening a folder with invalid files, show an error message to the user. References: https://todo.sr.ht/~rjarry/aerc/215 Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r--worker/maildir/worker.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 5ca648c4..643ab8a9 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -236,7 +236,7 @@ func (w *Worker) getDirectoryInfo(name string) *models.DirectoryInfo {
}
uids, err := w.c.UIDs(dir)
- if err != nil {
+ if err != nil && len(uids) == 0 {
w.worker.Errorf("could not get uids: %v", err)
return dirInfo
}
@@ -468,10 +468,16 @@ func (w *Worker) handleFetchDirectoryContents(
}
} else {
uids, err = w.c.UIDs(*w.selected)
- if err != nil {
+ if err != nil && len(uids) == 0 {
w.worker.Errorf("failed scanning uids: %v", err)
return err
}
+
+ if err != nil {
+ w.worker.PostMessage(&types.Error{
+ Error: fmt.Errorf("could not get all uids for %s: %w", *w.selected, err),
+ }, nil)
+ }
}
sortedUids, err := w.sort(msg.Context, uids, msg.SortCriteria)
if err != nil {