aboutsummaryrefslogtreecommitdiff
path: root/pkg/rfc822/writer.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkg/rfc822/writer.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/pkg/rfc822/writer.go b/pkg/rfc822/writer.go
index 07751ea..dd96fbb 100644
--- a/pkg/rfc822/writer.go
+++ b/pkg/rfc822/writer.go
@@ -23,29 +23,31 @@ func (f rfc822Writer) Write(p []byte) (n int, err error) {
crFound := false
start := 0
- write := func(str []byte) {
+ write := func(str []byte, count bool) {
var j int
j, err = f.w.Write(str)
- n = n + j
+ if count {
+ n += j
+ }
}
for idx, b := range p {
if crFound && b != '\n' {
// insert '\n'
- if write(p[start:idx]); err != nil {
+ if write(p[start:idx], true); err != nil {
return
}
- if write(lf); err != nil {
+ if write(lf, false); err != nil {
return
}
start = idx
} else if !crFound && b == '\n' {
// insert '\r'
- if write(p[start:idx]); err != nil {
+ if write(p[start:idx], true); err != nil {
return
}
- if write(cr); err != nil {
+ if write(cr, false); err != nil {
return
}
@@ -55,12 +57,12 @@ func (f rfc822Writer) Write(p []byte) (n int, err error) {
}
// write the remainder
- if write(p[start:]); err != nil {
+ if write(p[start:], true); err != nil {
return
}
if crFound { // dangling \r
- write(lf)
+ write(lf, false)
}
return
eed2imap-go.git/commit/internal/feed/item.go?h=v0.2.0&id=81714829dea0a8dddfdcd7a4a13df292fea255fc&follow=1'>FixRené 'Necoro' Neumann1-1/+1 2020-05-07Unified publishedDate and updatedDate into one (just as the old feed2imap...)René 'Necoro' Neumann5-21/+32 2020-05-06Print version during startupRené 'Necoro' Neumann1-1/+1 2020-05-06Improve templateRené 'Necoro' Neumann3-20/+28 2020-05-05Fix pipelineRené 'Necoro' Neumann1-2/+5 2020-05-05Make changelog a part of the release pipeline (untested)René 'Necoro' Neumann2-0/+12