lib/rest-ftp-daemon/helpers.rb in rest-ftp-daemon-0.202 vs lib/rest-ftp-daemon/helpers.rb in rest-ftp-daemon-0.202.1

- old
+ new

@@ -9,10 +9,10 @@ config[:endpoints] = Settings.endpoints.keys if Settings.endpoints config end def self.format_bytes number, unit="" - return "Ø" if number.nil? || number.zero? + return "Ø" if number.nil? || number.to_f.zero? units = ["", "k", "M", "G", "T", "P" ] index = ( Math.log( number ) / Math.log( 2 ) ).to_i / 10 converted = number.to_i / ( 1024 ** index ) "#{converted} #{units[index]}#{unit}"