Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: ServeFile adds garbage at end of file - Stat() gets wrong size from Mac OS #24423
Please answer these questions before submitting your issue. Thanks!
What did you do?
What did you expect to see?
The file sent as is.
What did you see instead?
The file is sent, but 6 extra garbage bytes are tacked on to the end. Stepping in to ServeFile, the cuplrit appears to be that Stat() is showing a file size of 40016, and so ServeFile goes ahead and reports the files size in the http header as 40016, and also reads the buffer past the end of the file.
This was also a problem in go 1.9.1