Browse Source

Remove lottie conversion temp dir after converting

Tulir Asokan 2 years ago
parent
commit
839933005c
1 changed files with 6 additions and 0 deletions
  1. 6 0
      attachments.go

+ 6 - 0
attachments.go

@@ -198,6 +198,12 @@ func (br *DiscordBridge) convertLottie(data []byte) ([]byte, string, error) {
 	if err != nil {
 		return nil, "", fmt.Errorf("failed to create temp dir: %w", err)
 	}
+	defer func() {
+		removErr := os.RemoveAll(tempdir)
+		if removErr != nil {
+			br.Log.Warnfln("Failed to delete lottie conversion temp dir: %v", removErr)
+		}
+	}()
 
 	lottieOutput := filepath.Join(tempdir, "out_")
 	if lottieTarget != "pngs" {