Avoid XML errors

This commit is contained in:
Steven Barth 2008-09-12 16:12:51 +00:00
parent 2bbc4eb3c3
commit 871f07ad2e
3 changed files with 10 additions and 6 deletions

View file

@ -192,14 +192,16 @@ end
--- Set the mime type of following content data. --- Set the mime type of following content data.
-- @param mime Mimetype of following content -- @param mime Mimetype of following content
function prepare_content(mime) function prepare_content(mime)
if mime == "application/xhtml+xml" then if not context.headers or not context.headers["content-type"] then
if not getenv("HTTP_ACCEPT") or if mime == "application/xhtml+xml" then
not getenv("HTTP_ACCEPT"):find("application/xhtml+xml", nil, true) then if not getenv("HTTP_ACCEPT") or
mime = "text/html; charset=UTF-8" not getenv("HTTP_ACCEPT"):find("application/xhtml+xml", nil, true) then
mime = "text/html; charset=UTF-8"
end
header("Vary", "Accept")
end end
header("Vary", "Accept") header("Content-Type", mime)
end end
header("Content-Type", mime)
end end
--- Get the RAW HTTP input source --- Get the RAW HTTP input source

View file

@ -213,6 +213,7 @@ function action_upgrade()
end end
end end
luci.http.prepare_content("text/html")
luci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) luci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail})
end end

View file

@ -110,6 +110,7 @@ function action_upgrade()
end end
end end
luci.http.prepare_content("text/html")
luci.template.render("mini/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) luci.template.render("mini/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail})
end end