mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 10:01:11 +08:00
make sure assets always use schemaless absolute uris
This commit is contained in:
@ -74,7 +74,6 @@ module Jobs
|
|||||||
options[:bypass_bump] = true if args[:bypass_bump] == true
|
options[:bypass_bump] = true if args[:bypass_bump] == true
|
||||||
post.revise(Discourse.system_user, raw, options)
|
post.revise(Discourse.system_user, raw, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_images_from(html)
|
def extract_images_from(html)
|
||||||
|
@ -12,6 +12,7 @@ class CookedPostProcessor
|
|||||||
@dirty = false
|
@dirty = false
|
||||||
@opts = opts
|
@opts = opts
|
||||||
@post = post
|
@post = post
|
||||||
|
@previous_cooked = (@post.cooked || "").dup
|
||||||
@doc = Nokogiri::HTML::fragment(post.cooked)
|
@doc = Nokogiri::HTML::fragment(post.cooked)
|
||||||
@size_cache = {}
|
@size_cache = {}
|
||||||
end
|
end
|
||||||
@ -58,7 +59,6 @@ class CookedPostProcessor
|
|||||||
src, width, height = img["src"], img["width"], img["height"]
|
src, width, height = img["src"], img["width"], img["height"]
|
||||||
limit_size!(img)
|
limit_size!(img)
|
||||||
convert_to_link!(img)
|
convert_to_link!(img)
|
||||||
@dirty |= (src != img["src"]) || (width.to_i != img["width"].to_i) || (height.to_i != img["height"].to_i)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
update_topic_image(images)
|
update_topic_image(images)
|
||||||
@ -130,8 +130,6 @@ class CookedPostProcessor
|
|||||||
end
|
end
|
||||||
|
|
||||||
add_lightbox!(img, original_width, original_height, upload)
|
add_lightbox!(img, original_width, original_height, upload)
|
||||||
|
|
||||||
@dirty = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_a_hyperlink?(img)
|
def is_a_hyperlink?(img)
|
||||||
@ -207,8 +205,6 @@ class CookedPostProcessor
|
|||||||
result = Oneboxer.apply(@doc) do |url, element|
|
result = Oneboxer.apply(@doc) do |url, element|
|
||||||
Oneboxer.onebox(url, args)
|
Oneboxer.onebox(url, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
@dirty |= result.changed?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def optimize_urls
|
def optimize_urls
|
||||||
@ -251,7 +247,7 @@ class CookedPostProcessor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def dirty?
|
def dirty?
|
||||||
@dirty
|
@previous_cooked != html
|
||||||
end
|
end
|
||||||
|
|
||||||
def html
|
def html
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
module UrlHelper
|
module UrlHelper
|
||||||
|
|
||||||
def is_local(url)
|
def is_local(url)
|
||||||
Discourse.store.has_been_uploaded?(url) || url =~ /^\/assets\//
|
Discourse.store.has_been_uploaded?(url) ||
|
||||||
|
url =~ /^\/assets\// ||
|
||||||
|
url.start_with?(Discourse.asset_host || Discourse.base_url_no_prefix)
|
||||||
end
|
end
|
||||||
|
|
||||||
def absolute(url)
|
def absolute(url)
|
||||||
|
Reference in New Issue
Block a user