Here is what the "project" module returns when we are creating empty releases:
Download latest release (2006-12-13, 2006-12-13 15:10, bytes)
Here is what it should return:
Download latest release (2006-12-13, 2006-12-13 15:10, 0 bytes)
I investigated and found where was that code and how to fix it. It's in the "project.inc" file, line 330. You should add 0 to the returned value of the filesize function. If the file doesn't exist, filesize returns FALSE, not zero. By adding 0 to it, we force a numeric type casting from the boolean value.
Here's my code:
$links[] = '<a href="'. base_path() . $release->path .'">' . t('Download latest release (%version, %date, %size)', array('%version' => $release->version, '%date' => format_date($release->changed, 'small'), '%size' => format_size(<strong>0 + filesize($release->path)</strong>))) . '</a>';
Comments
Comment #1
dwwi'd rather just not print "bytes" if filesize() returns FALSE.
also, please attach a patch. see http://drupal.org/diffandpatch for details.
thanks,
-derek
p.s. i'm not really planning to spend much time supporting releases in the 4.7.x-1.* series, since they're so much better in the 4.7.x-2.* series. however, the same sort of bug exists there, so i'd be happy to see it fixed in both branches).
Comment #2
dwwactually, i just realized this is duplicate with http://drupal.org/node/78278.
if you're going to spend any effort on this, please provide a patch there.
thanks!
-derek