From 653c291f1d81ac2399d7278a63979f7f79b92b14 Mon Sep 17 00:00:00 2001 From: enki Date: Wed, 27 Aug 2025 23:36:48 -0700 Subject: [PATCH] more fucking UI fixes --- internal/api/handlers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/api/handlers.go b/internal/api/handlers.go index 41cc722..adbb115 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -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)