Skip to content

Commit

Permalink
fix: temporary files not being correctly deleted (#969)
Browse files Browse the repository at this point in the history
* fix: use os.Remove for tmpFile

* fix: delete double file remove

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
  • Loading branch information
Oppen and fmartingr authored Aug 28, 2024
1 parent a4304bc commit 2bcb890
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/core/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func ProcessBookmark(deps *dependencies.Dependencies, req ProcessRequest) (book
if err != nil {
return book, false, fmt.Errorf("failed to create temp archive: %v", err)
}
defer deps.Domains.Storage.FS().Remove(tmpFile.Name())
defer os.Remove(tmpFile.Name())

archivalRequest := warc.ArchivalRequest{
URL: book.URL,
Expand All @@ -178,7 +178,6 @@ func ProcessBookmark(deps *dependencies.Dependencies, req ProcessRequest) (book

err = warc.NewArchive(archivalRequest, tmpFile.Name())
if err != nil {
defer os.Remove(tmpFile.Name())
return book, false, fmt.Errorf("failed to create archive: %v", err)
}

Expand Down

0 comments on commit 2bcb890

Please sign in to comment.