diff --git a/app/helpers/tickets_helper.rb b/app/helpers/tickets_helper.rb index e7635f3..fa9b9bc 100644 --- a/app/helpers/tickets_helper.rb +++ b/app/helpers/tickets_helper.rb @@ -3,6 +3,11 @@ module TicketsHelper if !site.nil? html = html.gsub("href=\"/uploads/","href=\"http://#{site.site_domain}/uploads/") html = html.gsub("src=\"/uploads/","src=\"http://#{site.site_domain}/uploads/") + temp_html = ActionView::Base.full_sanitizer.sanitize(html) + urls = URI.extract(temp_html,["http","https"]) + urls.each do |url| + html = html.sub(url, "#{url}") + end end return html end @@ -10,6 +15,11 @@ module TicketsHelper def smart_store_link_parser(html) html = html.gsub("href=\"/uploads/","href=\"http://#{request.host_with_port}/uploads/") html = html.gsub("src=\"/uploads/","src=\"http://#{request.host_with_port}/uploads/") + temp_html = ActionView::Base.full_sanitizer.sanitize(html) + urls = URI.extract(temp_html,["http","https"]) + urls.each do |url| + html = html.sub(url, "#{url}") + end return html end