aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-21 17:43:10 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-21 17:43:31 +0100
commit48c40ede273bec2f53dd8164db46f902a0b527c8 (patch)
tree77f211158d04abc0ac71222a036d99909e133539
parenta67e0e15cb1ff73c0faf7b4f9cdcd168ffbfa423 (diff)
downloadfeed2imap-go-48c40ede273bec2f53dd8164db46f902a0b527c8.tar.gz
feed2imap-go-48c40ede273bec2f53dd8164db46f902a0b527c8.tar.bz2
feed2imap-go-48c40ede273bec2f53dd8164db46f902a0b527c8.zip
#25 Normalize folder names
Diffstat (limited to '')
-rw-r--r--CHANGELOG.md6
-rw-r--r--internal/imap/folder.go10
2 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 651c0c6..f885f79 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,10 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
-### Added
+### Changed
- Remove `srcset` attribute of `img` tags when including images in mail
+- Strip whitespaces from folder names
+
### Fixed
- [Issue #39](https://github.com/Necoro/feed2imap-go/issues/39): Do not re-introduce deleted mails, even though `reupload-if-updated` is false.
+- [Issue #25](https://github.com/Necoro/feed2imap-go/issues/25): Normalize folder names, so `foo` and `foo/` are not seen as different folders.
+
## [0.6.0] - 2021-02-14
### Fixed
diff --git a/internal/imap/folder.go b/internal/imap/folder.go
index e845862..6353bb3 100644
--- a/internal/imap/folder.go
+++ b/internal/imap/folder.go
@@ -21,9 +21,17 @@ func (f Folder) Append(other Folder) Folder {
}
}
+func buildFolderName(path []string, delimiter string) (name string) {
+ name = strings.Join(path, delimiter)
+ if delimiter != "" {
+ name = strings.Trim(name, delimiter[0:1])
+ }
+ return
+}
+
func (cl *Client) folderName(path []string) Folder {
return Folder{
- strings.Join(path, cl.delimiter),
+ buildFolderName(path, cl.delimiter),
cl.delimiter,
}
}