diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 1c951b127..ffb2e630a 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -4260,6 +4260,26 @@ ostree_repo_delete_object (OstreeRepo *self, if (!ot_ensure_unlinked_at (self->objects_dir_fd, meta_loose, error)) return FALSE; + + /* Delete optional compat objects */ + const char compat_files_exts[][7] = { "sig", "sizes2" }; + for (gsize i = 0; i < G_N_ELEMENTS (compat_files_exts); i++) + { + const char *ext = compat_files_exts[i]; + char *buf = meta_loose; + + /* Write the compat object loose name manually since there's no + * loose path API that handles arbitrary file extensions + */ + *buf = sha256[0]; + buf++; + *buf = sha256[1]; + buf++; + snprintf (buf, _OSTREE_LOOSE_PATH_MAX - 2, "/%s.%s", sha256 + 2, ext); + + if (!ot_ensure_unlinked_at (self->objects_dir_fd, meta_loose, error)) + return FALSE; + } } if (!glnx_unlinkat (self->objects_dir_fd, loose_path, 0, error))