From f1864ab8bdabb9aa0010fd21af036e6850049612 Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 20 Oct 2020 18:12:13 +0100 Subject: Fix local queue deletion properly --- local.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/local.go b/local.go index 0aa8d1f..c2e16f6 100644 --- a/local.go +++ b/local.go @@ -81,7 +81,7 @@ func (a *LocalConn) CheckQueue(url string, timeout int64) (Qmsg, error) { if err != nil && err != io.EOF { return Qmsg{}, err } - s = strings.TrimSpace(s) + s = strings.TrimRight(s, "\n") return Qmsg{Body: s, Handle: s}, nil } @@ -184,12 +184,12 @@ func (a *LocalConn) DelFromQueue(url string, handle string) error { // store the joining of part before and part after handle var complete string - // the '+2' is 1 for newline character + 1 to move beyond handle - if len(s) >= len(handle) + 2 { + if len(s) >= len(handle) + 1 { if i > 0 { complete = s[:i] } - complete += s[i + len(handle) + 2:] + // the '+1' is for the newline character + complete += s[i + len(handle) + 1:] } f, err := os.Create(filepath.Join(a.TempDir, url)) -- cgit v1.2.1-24-ge1ad