aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/imap/folder.go10
-rw-r--r--internal/imap/imap.go6
-rw-r--r--pkg/config/url.go3
3 files changed, 13 insertions, 6 deletions
diff --git a/internal/imap/folder.go b/internal/imap/folder.go
index 6353bb3..d7562b8 100644
--- a/internal/imap/folder.go
+++ b/internal/imap/folder.go
@@ -15,8 +15,16 @@ func (f Folder) Append(other Folder) Folder {
if f.delimiter != other.delimiter {
panic("Delimiters do not match")
}
+
+ var prefix string
+ if f.str == "" {
+ prefix = ""
+ } else {
+ prefix = f.str + f.delimiter
+ }
+
return Folder{
- str: f.str + f.delimiter + other.str,
+ str: prefix + other.str,
delimiter: f.delimiter,
}
}
diff --git a/internal/imap/imap.go b/internal/imap/imap.go
index a6995af..4a18a94 100644
--- a/internal/imap/imap.go
+++ b/internal/imap/imap.go
@@ -39,8 +39,10 @@ func Connect(url config.Url) (*Client, error) {
log.Printf("Determined '%s' as toplevel, with '%s' as delimiter", client.toplevel, client.delimiter)
- if err = conn.ensureFolder(client.toplevel); err != nil {
- return nil, err
+ if toplevel != "" {
+ if err = conn.ensureFolder(client.toplevel); err != nil {
+ return nil, err
+ }
}
// the other connections
diff --git a/pkg/config/url.go b/pkg/config/url.go
index 403f787..06796a2 100644
--- a/pkg/config/url.go
+++ b/pkg/config/url.go
@@ -120,8 +120,5 @@ func (u *Url) validate() (errors []string) {
errors = append(errors, "Host not set")
}
- if u.Root == "" || u.Root == "/" {
- errors = append(errors, "Root path not set")
- }
return
}