mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:41:31 +08:00
Post processing of images adds prefix second time when post processing a post with one or more images if running with a prefix
This commit is contained in:
parent
5273657537
commit
68bdab6635
|
@ -45,7 +45,7 @@ class CookedPostProcessor
|
||||||
|
|
||||||
images.each do |img|
|
images.each do |img|
|
||||||
src = img['src']
|
src = img['src']
|
||||||
src = Discourse.base_url + src if src[0] == "/"
|
src = Discourse.base_url_no_prefix + src if src[0] == "/"
|
||||||
|
|
||||||
if src.present? && (img['width'].blank? || img['height'].blank?)
|
if src.present? && (img['width'].blank? || img['height'].blank?)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ module Discourse
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.base_url
|
def self.base_url_no_prefix
|
||||||
protocol = "http"
|
protocol = "http"
|
||||||
protocol = "https" if SiteSetting.use_ssl?
|
protocol = "https" if SiteSetting.use_ssl?
|
||||||
if SiteSetting.force_hostname.present?
|
if SiteSetting.force_hostname.present?
|
||||||
|
@ -35,10 +35,13 @@ module Discourse
|
||||||
result = "#{protocol}://#{current_hostname}"
|
result = "#{protocol}://#{current_hostname}"
|
||||||
end
|
end
|
||||||
result << ":#{SiteSetting.port}" if SiteSetting.port.present? && SiteSetting.port.to_i > 0
|
result << ":#{SiteSetting.port}" if SiteSetting.port.present? && SiteSetting.port.to_i > 0
|
||||||
result << ActionController::Base.config.relative_url_root if !ActionController::Base.config.relative_url_root.blank?
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.base_url
|
||||||
|
return base_url_no_prefix + base_uri
|
||||||
|
end
|
||||||
|
|
||||||
def self.enable_maintenance_mode
|
def self.enable_maintenance_mode
|
||||||
$redis.set maintenance_mode_key, 1
|
$redis.set maintenance_mode_key, 1
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user