Do content-negotiation to decide whether to send application/xhtml+xml or text/html.
Fixed the bozotic spam filter. Can you believe one can't use the word "texas" in Instiki?
This commit is contained in:
parent
ceb0931bb3
commit
29b4c4b837
2 changed files with 15 additions and 11 deletions
|
@ -148,8 +148,10 @@ class ApplicationController < ActionController::Base
|
|||
@response.headers['Content-Type'] = 'text/xml; charset=UTF-8'
|
||||
elsif %w(tex).include?(action_name)
|
||||
@response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
|
||||
else
|
||||
elsif Mime::Type.parse(@request.env["HTTP_ACCEPT"]).include?(Mime::XHTML)
|
||||
@response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8'
|
||||
else
|
||||
@response.headers['Content-Type'] = 'text/html; charset=UTF-8'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -191,3 +193,15 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
module Mime
|
||||
# Fix HTML
|
||||
#HTML = Type.new "text/html", :html, %w( application/xhtml+xml )
|
||||
HTML = Type.new "text/html", :html
|
||||
|
||||
# Add XHTML
|
||||
XHTML = Type.new "application/xhtml+xml", :xhtml
|
||||
|
||||
# Fix xhtml lookup
|
||||
LOOKUP["application/xhtml+xml"] = XHTML
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue