Fix DHT bootstrap URL parsing and transcoding completion handler
Some checks are pending
CI Pipeline / Run Tests (push) Waiting to run
CI Pipeline / Lint Code (push) Waiting to run
CI Pipeline / Security Scan (push) Waiting to run
CI Pipeline / E2E Tests (push) Blocked by required conditions

This commit is contained in:
Enki 2025-08-27 18:08:49 -07:00
parent bbc7c259b4
commit 35db6597e3

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"net" "net"
"net/url"
"sync" "sync"
"time" "time"
@ -518,13 +519,21 @@ func (d *DHTBootstrap) Stop() error {
// Helper functions // Helper functions
// extractHostname extracts hostname from URL // extractHostname extracts hostname from URL
func extractHostname(url string) string { func extractHostname(urlStr string) string {
// Simple URL parsing - in production use net/url // Parse the URL properly
if host, _, err := net.SplitHostPort(url); err == nil { if u, err := url.Parse(urlStr); err == nil {
// Extract hostname without port
if host, _, err := net.SplitHostPort(u.Host); err == nil {
return host
}
// If no port in URL, return the host directly
return u.Host
}
// Fallback - assume it's already just a hostname
if host, _, err := net.SplitHostPort(urlStr); err == nil {
return host return host
} }
// Fallback for URLs without port return urlStr
return url
} }
// isValidNodeID checks if a node ID is valid // isValidNodeID checks if a node ID is valid