Only RegEx if there is something to RegEx

This commit is contained in:
Dennis Schubert 2014-11-09 02:16:28 +01:00
parent db2560d7fc
commit 5c9cc49363

View file

@ -2,6 +2,7 @@
module Diaspora
module Camo
def self.from_markdown(markdown_text)
return unless markdown_text
markdown_text.gsub(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/m) do |link|
link.gsub($4, self.image_url($4))
end