From 48c40ede273bec2f53dd8164db46f902a0b527c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 21 Feb 2021 17:43:10 +0100 Subject: #25 Normalize folder names --- CHANGELOG.md | 6 +++++- internal/imap/folder.go | 10 +++++++++- 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, } } -- cgit v1.2.3