The ec_file_transfer() function in file.module does no error checking.

If there are any problems downloading the file, it behaves badly. For instance, if the file cannot be opened due to permissions, the download appears to hang, timeout after a while, and results in an empty download.

Even worse, if a problem occurs partway through a download (the fread() fails) the user could end up with a partial file and no notice that a problem occurred.

Recommended fix is to check the return codes of fopen() and fread().

I'd offer a patch, but I'm not sure what the preferred behavior would be if the system call fails. Any suggestions? Is there some function I can call to display a nice error message?

CommentFileSizeAuthor
#1 file_download_error_checking.patch2.08 KBchip

Comments

chip’s picture

Status: Active » Needs review
StatusFileSize
new2.08 KB

patch attached

brmassa’s picture

Status: Needs review » Fixed

Chip,

the File module has been rewritten for eC4.

regards,

massa

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.