lib/socialcast/command_line/provision.rb in socialcast-1.3.1 vs lib/socialcast/command_line/provision.rb in socialcast-1.3.2

- old
+ new

@@ -113,9 +113,18 @@ search_users_resource = Socialcast::CommandLine.resource_for_path '/api/users/search', http_config each_ldap_entry do |ldap, entry, attr_mappings, _| email = grab(entry, attr_mappings['email']) if profile_photo_data = grab(entry, attr_mappings['profile_photo']) + if profile_photo_data.start_with?('http') + begin + profile_photo_data = RestClient.get(profile_photo_data) + rescue => e + puts "Unable to download photo #{profile_photo_data} for #{email}" + puts e.response + next + end + end profile_photo_data = profile_photo_data.force_encoding('binary') user_search_response = search_users_resource.get(:params => { :q => email, :per_page => 1 }, :accept => :json) user_info = JSON.parse(user_search_response)['users'].first if user_info && user_info['avatars'] && user_info['avatars']['is_system_default']