Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion core/http/endpoints/localai/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: This mirrors the existing image endpoint URL policy for video inputs, so private/link-local/metadata hosts are rejected before the server issues an outbound request.

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
}
Expand Down
Loading