How to hide full path disclosure in error message?
{“failed”:“FAILED”,“message”:"/discourse/lib/upload_creator.rb:210:in `execute_convert’: An error happened when converting from PNG to JPG."}
How overwrite methods in Discourse::Utils.execute_command ?
Sorry, what are you reporting here? I don’t understand.
1 Like
I want to override this method
https://github.com/discourse/discourse/blob/master/lib/upload_creator.rb#L216
https://github.com/discourse/discourse/blob/master/lib/discourse.rb#L24-L33
That’s what I wanted to do
def self.execute_command(*command, failure_message: "")
Rails.logger.warn("this is plugin!!!")
stdout, stderr, status = Open3.capture3(*command)
if !status.success?
failure_message = "#{failure_message}\n" if !failure_message.blank?
if Rails.env == "development"
raise "#{caller[0]}: #{failure_message}#{stderr}"
else
raise "#{failure_message}#{stderr}"
end
end
stdout
end
This is not really Discourse-related but more Ruby-related. I suggest you properly learn Ruby with online courses before you continue writing plugins for Discourse.
1 Like