Remove duplicate file extension in DownloadFile (#230)

This commit is contained in:
mattn
2026-02-16 03:20:20 +09:00
committed by GitHub
parent c6c82b3c44
commit 1d748fb742

View File

@@ -73,9 +73,8 @@ func DownloadFile(url, filename string, opts DownloadOptions) string {
} }
// Generate unique filename with UUID prefix to prevent conflicts // Generate unique filename with UUID prefix to prevent conflicts
ext := filepath.Ext(filename)
safeName := SanitizeFilename(filename) safeName := SanitizeFilename(filename)
localPath := filepath.Join(mediaDir, uuid.New().String()[:8]+"_"+safeName+ext) localPath := filepath.Join(mediaDir, uuid.New().String()[:8]+"_"+safeName)
// Create HTTP request // Create HTTP request
req, err := http.NewRequest("GET", url, nil) req, err := http.NewRequest("GET", url, nil)