aboutsummaryrefslogtreecommitdiff
path: root/internal/feed
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 15:58:20 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 15:58:20 +0200
commit042361bc0cf7c0c4a0c14ee554e0e32c6088dee8 (patch)
tree57b59c17a7083133cd2248dc170447a1e3e38cb8 /internal/feed
parent253fef43021c14a7fd6f2ac3a377c34cd47cb8f6 (diff)
downloadfeed2imap-go-042361bc0cf7c0c4a0c14ee554e0e32c6088dee8.tar.gz
feed2imap-go-042361bc0cf7c0c4a0c14ee554e0e32c6088dee8.tar.bz2
feed2imap-go-042361bc0cf7c0c4a0c14ee554e0e32c6088dee8.zip
Fix template error when byteCount called with empty string
Diffstat (limited to 'internal/feed')
-rw-r--r--internal/feed/template/template.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/feed/template/template.go b/internal/feed/template/template.go
index 4c7b636..5a30c56 100644
--- a/internal/feed/template/template.go
+++ b/internal/feed/template/template.go
@@ -33,9 +33,12 @@ func lastUrlPart(url string) string {
}
func byteCount(str string) string {
- b, err := strconv.ParseUint(str, 10, 64)
- if err != nil {
- log.Printf("Cannot convert '%s' to byte count: %s", str, err)
+ var b uint64
+ if str != "" {
+ var err error
+ if b, err = strconv.ParseUint(str, 10, 64); err != nil {
+ log.Printf("Cannot convert '%s' to byte count: %s", str, err)
+ }
}
const unit = 1024