diff options
author | Steven Barth <steven@midlink.org> | 2008-09-12 16:12:51 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-09-12 16:12:51 +0000 |
commit | 871f07ad2e02040e10f85c7c77dca465932582ab (patch) | |
tree | ee100f70206b52f4336c724c3b898d444f6177a9 | |
parent | 2bbc4eb3c33c3590433174c599ec9418bdb8f38a (diff) |
Avoid XML errors
-rw-r--r-- | libs/web/luasrc/http.lua | 14 | ||||
-rw-r--r-- | modules/admin-full/luasrc/controller/admin/system.lua | 1 | ||||
-rw-r--r-- | modules/admin-mini/luasrc/controller/mini/system.lua | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua index 6b73b9414..c5a85ea4d 100644 --- a/libs/web/luasrc/http.lua +++ b/libs/web/luasrc/http.lua @@ -192,14 +192,16 @@ end --- Set the mime type of following content data. -- @param mime Mimetype of following content function prepare_content(mime) - if mime == "application/xhtml+xml" then - if not getenv("HTTP_ACCEPT") or - not getenv("HTTP_ACCEPT"):find("application/xhtml+xml", nil, true) then - mime = "text/html; charset=UTF-8" + if not context.headers or not context.headers["content-type"] then + if mime == "application/xhtml+xml" then + if not getenv("HTTP_ACCEPT") or + not getenv("HTTP_ACCEPT"):find("application/xhtml+xml", nil, true) then + mime = "text/html; charset=UTF-8" + end + header("Vary", "Accept") end - header("Vary", "Accept") + header("Content-Type", mime) end - header("Content-Type", mime) end --- Get the RAW HTTP input source diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 5d64336e0..c89c5859b 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -213,6 +213,7 @@ function action_upgrade() end end + luci.http.prepare_content("text/html") luci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) end diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index 6d16ef865..8b711d511 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -110,6 +110,7 @@ function action_upgrade() end end + luci.http.prepare_content("text/html") luci.template.render("mini/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) end |