Răsfoiți Sursa

Remove lottie conversion temp dir after converting

Tulir Asokan 2 ani în urmă
părinte
comite
839933005c
1 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  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" {