Skip to content

fix: correct Content-Length header in OTP download handler#327

Open
airouboss wants to merge 1 commit into
Adaptix-Framework:mainfrom
airouboss:fix/content-length-header
Open

fix: correct Content-Length header in OTP download handler#327
airouboss wants to merge 1 commit into
Adaptix-Framework:mainfrom
airouboss:fix/content-length-header

Conversation

@airouboss
Copy link
Copy Markdown

Found a bug in the OTP download handler in
AdaptixServer/core/connector/tc_otp.go around line 178.

The Content-Length header was being set incorrectly. The original
code used string(rune(fileInfo.Size())) which converts the file size
into a Unicode character instead of a number. So a 65 byte file would
send Content-Length: A instead of Content-Length: 65. For files over
1MB it gets even worse and the value becomes meaningless.

Fixed it by using strconv.FormatInt which correctly converts the file
size to a decimal string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant