Empty releases doesn't indicate the zero (0) before "byte"

TSK2006 - December 14, 2006 - 13:42
Project:Project
Version:4.7.x-1.0
Component:Releases
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

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>';

#1

dww - December 14, 2006 - 17:16
Status:patch (code needs review)» patch (code needs work)

i'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).

#2

dww - December 14, 2006 - 19:26
Status:patch (code needs work)» duplicate

actually, 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

 
 

Drupal is a registered trademark of Dries Buytaert.