Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit e436fbe

Browse files
author
Jean-Christophe Sirot
committed
Allow removing an App when referenced by id in unambiguous cases
Signed-off-by: Jean-Christophe Sirot <[email protected]>
1 parent 61e61a8 commit e436fbe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/store/bundle.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ func (b *bundleStore) List() ([]reference.Reference, error) {
112112

113113
// Remove removes a bundle from the bundle store.
114114
func (b *bundleStore) Remove(ref reference.Reference) error {
115+
if id, ok := ref.(ID); ok {
116+
if len(b.refsMap[id]) == 0 {
117+
return fmt.Errorf("no such image %q", reference.FamiliarString(ref))
118+
} else if len(b.refsMap[id]) > 1 {
119+
return fmt.Errorf("unable to delete %s - App is referenced in multiple repositories", reference.FamiliarString(ref))
120+
}
121+
ref = b.refsMap[id][0]
122+
}
115123
path, err := b.storePath(ref)
116124
if err != nil {
117125
return err

0 commit comments

Comments
 (0)