mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Merge pull request #3387 from riking/fix-uploaded-onebox
FIX: Local files never oneboxed, onebox requests cache-busted
This commit is contained in:
commit
afc12da2f9
2 changed files with 21 additions and 1 deletions
|
@ -51,7 +51,8 @@ Discourse.Onebox = {
|
|||
// Retrieve the onebox
|
||||
var promise = Discourse.ajax("/onebox", {
|
||||
dataType: 'html',
|
||||
data: { url: url, refresh: refresh }
|
||||
data: { url: url, refresh: refresh },
|
||||
cache: true
|
||||
});
|
||||
|
||||
// We can call this when loading is complete
|
||||
|
|
|
@ -10,6 +10,25 @@ module Onebox
|
|||
1
|
||||
end
|
||||
|
||||
def self.===(other)
|
||||
if other.kind_of?(URI)
|
||||
uri = other
|
||||
begin
|
||||
route = Rails.application.routes.recognize_path(uri.path)
|
||||
case route[:controller]
|
||||
when 'topics'
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
rescue ActionController::RoutingError
|
||||
false
|
||||
end
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def to_html
|
||||
uri = URI::parse(@url)
|
||||
route = Rails.application.routes.recognize_path(uri.path)
|
||||
|
|
Loading…
Reference in a new issue