1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Checking path for nil

This commit is contained in:
Timothy Klim 2011-06-25 21:48:54 +04:00
parent c8244b4930
commit 99a932ef6d

View file

@ -60,7 +60,7 @@ module Fog
metadata[:body] = data metadata[:body] = data
metadata[:headers]['Content-Length'] = get_body_size(data) metadata[:headers]['Content-Length'] = get_body_size(data)
if data.respond_to?(:path) if data.respond_to?(:path) and !data.path.nil?
filename = ::File.basename(data.path) filename = ::File.basename(data.path)
unless (mime_types = MIME::Types.of(filename)).empty? unless (mime_types = MIME::Types.of(filename)).empty?
metadata[:headers]['Content-Type'] = mime_types.first.content_type metadata[:headers]['Content-Type'] = mime_types.first.content_type