Skip to content

A platform for community discussion. Free, open, simple.

FIX: need to require open-uri for discourse-narrative-bot plugin

Blake Ericksonb69450bee2d6
diff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rb
index b42e3e4c2c9..da8f9dd015c 100644
--- a/plugins/discourse-narrative-bot/plugin.rb
+++ b/plugins/discourse-narrative-bot/plugin.rb
@@ -6,6 +6,8 @@
# authors: Nick Sahler, Alan Tan
# url: https://github.com/discourse/discourse/tree/master/plugins/discourse-narrative-bot
+require 'open-uri'
+
enabled_site_setting :discourse_narrative_bot_enabled
hide_plugin if self.respond_to?(:hide_plugin)
@@ -109,7 +111,7 @@ after_initialize do
def fetch_avatar_url(user)
avatar_url = UrlHelper.absolute(Discourse.base_uri + user.avatar_template.gsub('{size}', '250'))
- URI(avatar_url).open('rb', redirect: true, allow_redirections: :all).read
+ open(avatar_url, 'rb').read
rescue OpenURI::HTTPError
# Ignore if fetching image returns a non 200 response
end