Validate video image URLs before download (#9819)

Signed-off-by: massy-o <telitos000@gmail.com>
This commit is contained in:
massy_o
2026-05-14 22:07:17 +09:00
committed by GitHub
parent 594c9fd92e
commit 745473cbe6

View File

@@ -22,12 +22,19 @@ import (
"github.com/mudler/LocalAI/core/backend"
model "github.com/mudler/LocalAI/pkg/model"
"github.com/mudler/LocalAI/pkg/utils"
"github.com/mudler/xlog"
)
var videoDownloadClient = http.Client{Timeout: 30 * time.Second}
func downloadFile(url string) (string, error) {
if err := utils.ValidateExternalURL(url); err != nil {
return "", fmt.Errorf("URL validation failed: %w", err)
}
// Get the data
resp, err := http.Get(url)
resp, err := videoDownloadClient.Get(url)
if err != nil {
return "", err
}