From b80320da5eae6233d3bd90b3ebe60772468bfab4 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 28 Sep 2017 11:32:26 +1000 Subject: [PATCH] no verbose logging for failed downloads of gravatars --- app/models/user_avatar.rb | 3 ++- lib/file_helper.rb | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/user_avatar.rb b/app/models/user_avatar.rb index 8e9de17baf1..bb3146970f0 100644 --- a/app/models/user_avatar.rb +++ b/app/models/user_avatar.rb @@ -24,7 +24,8 @@ class UserAvatar < ActiveRecord::Base gravatar_url, max_file_size: SiteSetting.max_image_size_kb.kilobytes, tmp_file_name: "gravatar", - skip_rate_limit: true + skip_rate_limit: true, + verbose: false ) if tempfile upload = UploadCreator.new(tempfile, 'gravatar.png', origin: gravatar_url, type: "avatar").create_for(user_id) diff --git a/lib/file_helper.rb b/lib/file_helper.rb index 6689f738355..f008ac72c45 100644 --- a/lib/file_helper.rb +++ b/lib/file_helper.rb @@ -20,7 +20,11 @@ class FileHelper tmp_file_name:, follow_redirect: false, read_timeout: 5, - skip_rate_limit: false) + skip_rate_limit: false, + verbose: nil) + + # verbose logging is default while debugging onebox + verbose = verbose.nil? ? true : verbose url = "https:" + url if url.start_with?("//") raise Discourse::InvalidParameters.new(:url) unless url =~ /^https?:\/\// @@ -32,7 +36,7 @@ class FileHelper ).resolve unless uri.present? - log(:error, "FinalDestination did not work for: #{url}") + log(:error, "FinalDestination did not work for: #{url}") if verbose return end