You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the discussion we had in gabriel-vasile/mimetype#310, I had a look at the copier.StreamCopier and I think there is a problem.
step1: extensionFromBody will read file header in order to detect extension. It reads from a bufio.Reader which, in turn, reads from resp.Body.
step2: Later, io.Copy(output, resp.Body) is called and, because the header was already read in step1, it is skipped.
You can confirm the problem by saving a URL twice:
once using radiot_dumper (make sure extensionFromBody is called when you test)
second time use the browser to save the file.
Then, compare the file saved with radiot_dumper and the file saved using the browser. The radiot_dumper file will be smaller because it is missing the header.
The text was updated successfully, but these errors were encountered:
After the discussion we had in gabriel-vasile/mimetype#310, I had a look at the
copier.StreamCopier
and I think there is a problem.step1: extensionFromBody will read file header in order to detect extension. It reads from a
bufio.Reader
which, in turn, reads fromresp.Body
.step2: Later,
io.Copy(output, resp.Body)
is called and, because the header was already read in step1, it is skipped.You can confirm the problem by saving a URL twice:
radiot_dumper
(make sure extensionFromBody is called when you test)Then, compare the file saved with
radiot_dumper
and the file saved using the browser. Theradiot_dumper
file will be smaller because it is missing the header.The text was updated successfully, but these errors were encountered: