diff options
author | Nick White <git@njw.name> | 2020-06-02 16:32:09 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-06-02 16:32:09 +0100 |
commit | 3d27bebcc9f0917923adcecd730d4e046c841276 (patch) | |
tree | 0253cd4562b1f7d0804107c76eea4739beedf71a /local.go | |
parent | dab03345abce18b4cfde479f2be67a07d05b77e9 (diff) |
Proper full fix for local queue handling (hopefully)
Diffstat (limited to 'local.go')
-rw-r--r-- | local.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -178,9 +178,19 @@ func (a *LocalConn) DelFromQueue(url string, handle string) error { s := string(b) i := strings.Index(s, handle) + if i == -1 { + return fmt.Errorf("Warning: %s not found in queue %s, so not deleted", handle, url) + } // store the joining of part before and part after handle - complete := s[0:i] + s[i + len(handle) + 2:len(s)] + var complete string + // the '+2' is 1 for newline character + 1 to move beyond handle + if len(s) >= len(handle) + 2 { + if i > 0 { + complete = s[0:i] + } + complete += s[i + len(handle) + 2:len(s)] + } f, err := os.Create(filepath.Join(a.TempDir, url)) if err != nil { |