From 15cad1781024d85fa176235a937977b12e811f34 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 16 Oct 2013 12:19:20 -0400 Subject: [PATCH] FIX: Nokogiri bugs in certain environments --- Gemfile.lock | 8 +++++--- app/models/post_analyzer.rb | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c27c426bfdb..03c2e6c1228 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -246,6 +246,7 @@ GEM metaclass (0.0.1) method_source (0.8.1) mime-types (1.23) + mini_portile (0.5.1) minitest (4.7.3) mocha (0.13.3) metaclass (~> 0.0.1) @@ -256,7 +257,8 @@ GEM net-scp (1.1.2) net-ssh (>= 2.6.5) net-ssh (2.6.8) - nokogiri (1.5.9) + nokogiri (1.6.0) + mini_portile (~> 0.5.0) oauth (0.4.7) oauth2 (0.8.1) faraday (~> 0.8) @@ -390,8 +392,8 @@ GEM rspec-mocks (~> 2.13.0) ruby-hmac (0.4.0) ruby-openid (2.2.3) - sanitize (2.0.3) - nokogiri (>= 1.4.4, < 1.6) + sanitize (2.0.6) + nokogiri (>= 1.4.4) sass (3.2.8) sass-rails (3.2.6) railties (~> 3.2.0) diff --git a/app/models/post_analyzer.rb b/app/models/post_analyzer.rb index ac1cf6fc54c..8f5d703c199 100644 --- a/app/models/post_analyzer.rb +++ b/app/models/post_analyzer.rb @@ -95,8 +95,8 @@ class PostAnalyzer # Don't include @mentions in the link count @raw_links = [] - cooked_document.search("a[href]").each do |l| - next if link_is_a_mention?(l) + cooked_document.search("a").each do |l| + next if l.attributes['href'].nil? || link_is_a_mention?(l) url = l.attributes['href'].to_s @raw_links << url end