At the moment, downloads are being appended one after another in the output file, so it gets broken if the original download returned something, but the response code wasn't successful.
This PR truncates the file to make it empty before copying the download content there.
At the moment, downloads are being appended one after another in the output file, so it gets broken if the original download returned something, but the response code wasn't successful.
This PR truncates the file to make it empty before copying the download content there.