app/controllers/cookbooks.rb in chef-server-api-0.10.4 vs app/controllers/cookbooks.rb in chef-server-api-0.10.6.beta.1

- old
+ new

@@ -137,13 +137,16 @@ cookbook = get_cookbook_version(cookbook_name, cookbook_version) checksum = params[:checksum] raise NotFound, "Cookbook #{cookbook_name} version #{cookbook_version} does not contain a file with checksum #{checksum}" unless cookbook.checksums.keys.include?(checksum) - filename = Chef::Checksum.new(checksum).file_location - raise InternalServerError, "File with checksum #{checksum} not found in the repository (this should not happen)" unless File.exists?(filename) + begin + filename = Chef::Checksum.new(checksum).storage.file_location - send_file(filename) + send_file(filename) + rescue Errno::ENOENT => e + raise InternalServerError, "File with checksum #{checksum} not found in the repository (this should not happen)" + end end def update raise(BadRequest, "You didn't pass me a valid object!") unless params.has_key?('inflated_object') raise(BadRequest, "You didn't pass me a Chef::CookbookVersion object!") unless params['inflated_object'].kind_of?(Chef::CookbookVersion)