Skip to content

Commit

Permalink
s3: cleanup pathCache when removing files
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Jan 6, 2024
1 parent ff07d2b commit 503032c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions s3/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ func (storage *PublishedStorage) Remove(path string) error {
// try to remove workaround version, but don't care about result
_ = storage.Remove(strings.Replace(path, "+", " ", -1))
}

delete(storage.pathCache, path)

return nil
}

Expand All @@ -259,6 +262,7 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error
if err != nil {
return fmt.Errorf("error deleting path %s from %s: %s", filelist[i], storage, err)
}
delete(storage.pathCache, filepath.Join(path, filelist[i]))
}
} else {
numParts := (len(filelist) + page - 1) / page
Expand Down Expand Up @@ -290,6 +294,9 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error
if err != nil {
return fmt.Errorf("error deleting multiple paths from %s: %s", storage, err)
}
for i := range part {
delete(storage.pathCache, filepath.Join(path, part[i]))
}
}
}

Expand Down

0 comments on commit 503032c

Please sign in to comment.