Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for 16 vs 32 bit integers in folder upload #154

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion hotline/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,20 @@ func (s *Server) handleFileTransfer(ctx context.Context, rwc io.ReadWriter) erro
s.Stats.Decrement(StatUploadsInProgress)
}()

var transferSizeValue uint32
switch len(fileTransfer.TransferSize) {
case 2: // 16-bit
transferSizeValue = uint32(binary.BigEndian.Uint16(fileTransfer.TransferSize))
case 4: // 32-bit
transferSizeValue = binary.BigEndian.Uint32(fileTransfer.TransferSize)
default:
rLogger.Warn("Unexpected TransferSize length: %d bytes", len(fileTransfer.TransferSize))
}

rLogger.Info(
"Folder upload started",
"dstPath", fullPath,
"TransferSize", binary.BigEndian.Uint32(fileTransfer.TransferSize),
"TransferSize", transferSizeValue,
"FolderItemCount", fileTransfer.FolderItemCount,
)

Expand Down
Loading