2013-11-20 07:10:08 -05:00
|
|
|
module UrlHelper
|
|
|
|
|
|
|
|
def is_local(url)
|
2013-12-06 05:16:13 -05:00
|
|
|
Discourse.store.has_been_uploaded?(url) ||
|
|
|
|
url =~ /^\/assets\// ||
|
|
|
|
url.start_with?(Discourse.asset_host || Discourse.base_url_no_prefix)
|
2013-11-20 07:10:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def absolute(url)
|
|
|
|
url =~ /^\/[^\/]/ ? (Discourse.asset_host || Discourse.base_url_no_prefix) + url : url
|
|
|
|
end
|
|
|
|
|
|
|
|
def schemaless(url)
|
|
|
|
url.gsub(/^https?:/, "")
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|