diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-10-17 16:52:16 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-10-18 18:36:04 +0200 |
commit | 44ff3d08a0e1f3b49e07795a9fdb0ad3af4c7540 (patch) | |
tree | cebad37bcb517d2ba99e3923d9cb725f831f82e5 /pkg | |
parent | 925683b5810a3707831a30ac59a7a446af21c5f1 (diff) | |
download | feed2imap-go-44ff3d08a0e1f3b49e07795a9fdb0ad3af4c7540.tar.gz feed2imap-go-44ff3d08a0e1f3b49e07795a9fdb0ad3af4c7540.tar.bz2 feed2imap-go-44ff3d08a0e1f3b49e07795a9fdb0ad3af4c7540.zip |
URL: Do not print '@' when no user is given
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/config/url.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/config/url.go b/pkg/config/url.go index 9621672..39cce16 100644 --- a/pkg/config/url.go +++ b/pkg/config/url.go @@ -64,12 +64,18 @@ func (u *Url) UnmarshalYAML(value *yaml.Node) (err error) { } func (u *Url) String() string { + scheme := u.Scheme + "://" + var pwd string if u.Password != "" { pwd = ":******" } + var delim string + if pwd != "" || u.User != "" { + delim = "@" + } - return fmt.Sprintf("%s://%s%s@%s%s", u.Scheme, u.User, pwd, u.HostPort(), u.Root) + return scheme + u.User + pwd + delim + u.HostPort() + u.Root } func (u *Url) HostPort() string { |