Procházet zdrojové kódy

Remove lottie conversion temp dir after converting

Tulir Asokan před 2 roky
rodič
revize
839933005c
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  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" {