fix: prune RPM metadata when a local file is evicted
Evicting or deleting a local RPM removed the local_files row but left its rpm_metadata behind, so generated repodata kept listing a package that no longer exists. Deletes now run a provider cleanup hook symmetric to the existing upload hook. - add PostDeleteHook and MetadataDeleter provider interfaces, plus a DeleteRPMMetadata DB method - implement AfterDelete in the RPM provider to drop the metadata row - route both local delete paths (evictLocal and the files handler) through a shared deleteLocalFile helper that removes the file then runs the hook - cover the cleanup with a dockerised test
This commit is contained in:
@@ -75,7 +75,7 @@ func (h *ObjectsHandler) evictLocal(w http.ResponseWriter, r *http.Request) {
|
||||
repoName := chi.URLParam(r, "name")
|
||||
path := chi.URLParam(r, "*")
|
||||
|
||||
if err := h.db.DeleteLocalFile(r.Context(), repoName, path); err != nil {
|
||||
if err := deleteLocalFile(r.Context(), h.db, repoName, path); err != nil {
|
||||
http.Error(w, fmt.Sprintf("evict failed: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user