#81 Remove downloaded invalid file
Merged by cqi. Opened by cqi.
cqi/rpkg remove-invalid-downloaded-file-issue-79  into  master

Download 81.patch

By using pycurl to download a file from lookaside, invalid content sent
back from server is stored into the downloaded file, even if server does
not response such as 404. The downloaded file should be removed in order
to avoid many confusion to packagers.

Fix #79

Signed-off-by: Chenxiong Qi cqi@redhat.com

Is it possible that the file would not actually get created in some case? Deleting it would fail then. But overall I think this is good to be merged.

Is it possible that the file would not actually get created in some case?

Did not find that way so far. But, there could be a workaround to achieve this.

  1. write http response to cStringIO buffer
  2. if status code is 200, write data from buffer to file
  3. if status code is not 200, raise the error and drop the buffer

It might cause a potential memory issue, if there is a large binary file.

I'm going to merge this first. If find a better way afterward, I'll improve it.

I also don't see a way the request could fail to create the file: even if the response were empty, an empty file would be created in my opinion. There is no need to change this patch. If it turns out there is some corner case, we can fix when we get to it.

Pull-Request has been merged by cqi

Metadata