lib/fastdfs-client/storage.rb in fastdfs-client-1.0.1 vs lib/fastdfs-client/storage.rb in fastdfs-client-1.0.2
- old
+ new
@@ -16,10 +16,10 @@
@size_len = ProtoCommon::SIZE_LEN
@store_path = store_path || 0
end
def upload(file, options = {})
- ext_name_bs = File.extname(file)[1..-1].bytes.full_fill(0, @extname_len)
+ ext_name_bs = File.extname(file)[1..-1].to_s.bytes.full_fill(0, @extname_len)
size_byte = ([@store_path] + Utils.number_to_buffer(file.size)).full_fill(0, @size_len)
content_len = (@size_len + @extname_len + file.size)
client = ClientProxy.new(CMD::UPLOAD_FILE, @socket, content_len, size_byte + ext_name_bs)
client.push_content{ IO.read(file) }
\ No newline at end of file