Avoid XML errors
authorSteven Barth <steven@midlink.org>
Fri, 12 Sep 2008 16:12:51 +0000 (16:12 +0000)
committerSteven Barth <steven@midlink.org>
Fri, 12 Sep 2008 16:12:51 +0000 (16:12 +0000)
libs/web/luasrc/http.lua
modules/admin-full/luasrc/controller/admin/system.lua
modules/admin-mini/luasrc/controller/mini/system.lua

index 6b73b9414cf0c129a1596ac4144b64d12fc529da..c5a85ea4d9f777187855549adabf0c18e199f32a 100644 (file)
@@ -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
index 5d64336e03ee7192b0a695de78ff7d0e443108f2..c89c5859b91af9f76412abb0b77aeff9514e8a2a 100644 (file)
@@ -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
 
index 6d16ef8650e22c91e7ea1616f20384f8ccb5d4dd..8b711d511c6afd54699fe0167c76452a254878cc 100644 (file)
@@ -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