Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(installer): handle removal of deleted templates during update #5998

7 changes: 7 additions & 0 deletions pkg/installer/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ func (t *TemplateManager) updateTemplatesAt(dir string) error {
// summarize all changes
results := t.summarizeChanges(oldchecksums, newchecksums)

// remove deleted templates
for _, deletion := range results.deletions {
if err := os.Remove(deletion); err != nil {
gologger.Warning().Msgf("failed to remove deleted template %s: %s", deletion, err)
}
}
dwisiswant0 marked this conversation as resolved.
Show resolved Hide resolved

// print summary
if results.totalCount > 0 {
gologger.Info().Msgf("Successfully updated nuclei-templates (%v) to %s. GoodLuck!", ghrd.Latest.GetTagName(), dir)
Expand Down
Loading