From 6110df20bd10d12b72ad2c125c6377b12cb0f810 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Mon, 1 Jul 2019 10:38:47 +0800 Subject: [PATCH] fix bug --- app/helpers/application_helper.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cb2f487cb..df024264e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -336,6 +336,8 @@ module ApplicationHelper def to_markdown(text) Rails.logger.info("#########################text______________tedxt_________________###{text}") + Rails.logger.info("#########################text______________request_base_url________________###{request.base_url}") + return nil if text.blank? options = { :autolink => true, @@ -347,10 +349,10 @@ module ApplicationHelper :tables => true } markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,options) - ss = markdown.render(text) - Rails.logger.info("#########################text______________markdown.render(text)________________###{ss}") - ss - + m_t = markdown.render(text) + q_title = m_t &.include?("src=\"") ? m_t&.gsub("src=\"","src=\"#{@request_url}")&.html_safe : m_t + Rails.logger.info("#########################text______________markdown.render(text)________________###{q_title }") + q_title end end