more fucking UI fixes
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 23:36:48 -07:00
parent c82d5554d8
commit 653c291f1d

View File

@ -733,12 +733,15 @@ func (g *Gateway) UploadHandler(w http.ResponseWriter, r *http.Request) {
// Size-based routing: decide between blob and torrent storage
blobThreshold := g.config.GetBlobThreshold()
log.Printf("DEBUG: Upload routing - File: %s, Size: %d bytes, BlobThreshold: %d bytes", fileName, fileHeader.Size, blobThreshold)
if fileHeader.Size < blobThreshold {
// Small file - store as single Blossom blob
log.Printf("DEBUG: Routing %s to BLOB storage (size %d < threshold %d)", fileName, fileHeader.Size, blobThreshold)
g.handleBlobUpload(w, r, file, fileName, fileHeader)
return
} else {
// Large file - use existing chunking logic
log.Printf("DEBUG: Routing %s to TORRENT storage (size %d >= threshold %d)", fileName, fileHeader.Size, blobThreshold)
g.handleTorrentUpload(w, r, file, fileName, fileHeader)
return
}
@ -746,6 +749,7 @@ func (g *Gateway) UploadHandler(w http.ResponseWriter, r *http.Request) {
// handleBlobUpload handles small files that should be stored as single Blossom blobs
func (g *Gateway) handleBlobUpload(w http.ResponseWriter, r *http.Request, file multipart.File, fileName string, fileHeader *multipart.FileHeader) {
log.Printf("DEBUG: handleBlobUpload called for file: %s (size: %d bytes)", fileName, fileHeader.Size)
// Determine content type
contentType := fileHeader.Header.Get("Content-Type")
if contentType == "" {
@ -880,6 +884,7 @@ func (g *Gateway) handleBlobUpload(w http.ResponseWriter, r *http.Request, file
// handleTorrentUpload handles large files that should be chunked for BitTorrent
func (g *Gateway) handleTorrentUpload(w http.ResponseWriter, r *http.Request, file multipart.File, fileName string, fileHeader *multipart.FileHeader) {
log.Printf("DEBUG: handleTorrentUpload called for file: %s (size: %d bytes)", fileName, fileHeader.Size)
// Reset file reader position
file.Seek(0, 0)