X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/dcd23d5355badf66c34ffd63d3c44734e87ebf17..6e4935b32843d1007b1070275d4e99edb345d6bc:/hotline/file_transfer.go diff --git a/hotline/file_transfer.go b/hotline/file_transfer.go index 12725db..b11aeae 100644 --- a/hotline/file_transfer.go +++ b/hotline/file_transfer.go @@ -326,12 +326,14 @@ func UploadHandler(rwc io.ReadWriter, fullPath string, fileTransfer *FileTransfe } } + defer file.Close() + f, err := NewFileWrapper(fileStore, fullPath, 0) if err != nil { return err } - rLogger.Info("File upload started", "dstFile", fullPath) + rLogger.Debug("File upload started", "dstFile", fullPath) rForkWriter := io.Discard iForkWriter := io.Discard @@ -348,15 +350,11 @@ func UploadHandler(rwc io.ReadWriter, fullPath string, fileTransfer *FileTransfe } if err := receiveFile(rwc, file, rForkWriter, iForkWriter, fileTransfer.bytesSentCounter); err != nil { - rLogger.Error(err.Error()) - } - - if err := file.Close(); err != nil { - return err + return fmt.Errorf("receive file: %v", err) } if err := fileStore.Rename(fullPath+".incomplete", fullPath); err != nil { - return err + return fmt.Errorf("rename incomplete file: %v", err) } rLogger.Info("File upload complete", "dstFile", fullPath) @@ -421,7 +419,6 @@ func DownloadFolderHandler(rwc io.ReadWriter, fullPath string, fileTransfer *Fil } subPath := path[basePathLen+1:] - rLogger.Debug("Sending fileheader", "i", i, "path", path, "fullFilePath", fullPath, "subPath", subPath, "IsDir", info.IsDir()) if i == 1 { return nil @@ -437,8 +434,6 @@ func DownloadFolderHandler(rwc io.ReadWriter, fullPath string, fileTransfer *Fil return err } - rLogger.Debug("Client folder download action", "action", fmt.Sprintf("%X", nextAction[0:2])) - var dataOffset int64 switch nextAction[1] {