summaryrefslogtreecommitdiff
path: root/local.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-10-20 18:12:13 +0100
committerNick White <git@njw.name>2020-10-20 18:12:13 +0100
commitf1864ab8bdabb9aa0010fd21af036e6850049612 (patch)
treeb28c505ed93a4ad090e7625df7ecfaa79532bb38 /local.go
parentd06fe7be371041cb7698a1562a2c7153c8c8f20b (diff)
Fix local queue deletion properly
Diffstat (limited to 'local.go')
-rw-r--r--local.go8
1 files 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))