fix(backends gallery): delete dangling dirs if installation failed (#5729)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-06-26 17:38:03 +02:00
committed by GitHub
parent c6f50ddd0c
commit bcccee3909

View File

@@ -31,6 +31,10 @@ func (g *GalleryService) backendHandler(op *GalleryOp[gallery.GalleryBackend], s
}
if err != nil {
log.Error().Err(err).Msgf("error installing backend %s", op.GalleryElementName)
if !op.Delete {
// If we didn't install the backend, we need to make sure we don't have a leftover directory
gallery.DeleteBackendFromSystem(g.appConfig.BackendsPath, op.GalleryElementName)
}
return err
}