more fucking UI fixes
This commit is contained in:
parent
c82d5554d8
commit
653c291f1d
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user