aboutsummaryrefslogtreecommitdiff
path: root/internal/imap
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-10-17 13:33:55 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-10-17 13:33:55 +0200
commit50a50d736b5d5f1e9e2ef3c6afa6b4c0d3e50677 (patch)
treef227a996214cdaf4f6b099a7fe3dc7f09394fb5d /internal/imap
parentc369f615b0b53471a9f6d214e847bcaa1703ea5a (diff)
downloadfeed2imap-go-50a50d736b5d5f1e9e2ef3c6afa6b4c0d3e50677.tar.gz
feed2imap-go-50a50d736b5d5f1e9e2ef3c6afa6b4c0d3e50677.tar.bz2
feed2imap-go-50a50d736b5d5f1e9e2ef3c6afa6b4c0d3e50677.zip
#62: Root can be empty
Diffstat (limited to 'internal/imap')
-rw-r--r--internal/imap/folder.go10
-rw-r--r--internal/imap/imap.go6
2 files changed, 13 insertions, 3 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