diff options
author | Nick White <git@njw.name> | 2020-10-20 18:12:13 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-10-20 18:12:13 +0100 |
commit | f1864ab8bdabb9aa0010fd21af036e6850049612 (patch) | |
tree | b28c505ed93a4ad090e7625df7ecfaa79532bb38 | |
parent | d06fe7be371041cb7698a1562a2c7153c8c8f20b (diff) |
Fix local queue deletion properly
-rw-r--r-- | local.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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)) |