From 6f592eddb2bbb1310a85a34b31c37af674fb023d Mon Sep 17 00:00:00 2001 From: Blog cron job Date: Thu, 21 Sep 2017 08:33:28 +0200 Subject: [PATCH] Encoding error handling in expandlinks --- scripts/expandlinks.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/expandlinks.rb b/scripts/expandlinks.rb index 431a63b8..9c39b3c9 100644 --- a/scripts/expandlinks.rb +++ b/scripts/expandlinks.rb @@ -57,7 +57,11 @@ CSV.open(ARGV[1], 'wb') do |out| newlink = follow_url(link) if (newlink!=link) # puts "#{link} --> #{newlink}" - tweet.gsub!(link, newlink) + begin + tweet.gsub!(link, newlink) + rescue + puts "Encoding fsckup in #{newlink}" + end end } row[3] = tweet