Fix bad encoding of static files.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3395 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
a47043955e
commit
3ca8659bba
@ -237,18 +237,21 @@ async function handler(request, response, packageOwner, packageName, uri) {
|
||||
for (var i in kStaticFiles) {
|
||||
if (uri === kStaticFiles[i].uri) {
|
||||
found = true;
|
||||
var data = new TextDecoder("UTF-8").decode(File.readFile("core/" + kStaticFiles[i].path));
|
||||
if (kStaticFiles[i].uri == "") {
|
||||
if (gGlobalSettings && gGlobalSettings['google-signin-client_id']) {
|
||||
data = data.replace("<!--HEAD-->", `
|
||||
var data = File.readFile("core/" + kStaticFiles[i].path);
|
||||
if (kStaticFiles[i].type.indexOf("text/") == 0) {
|
||||
data = new TextDecoder("UTF-8").decode(data);
|
||||
if (kStaticFiles[i].uri == "") {
|
||||
if (gGlobalSettings && gGlobalSettings['google-signin-client_id']) {
|
||||
data = data.replace("<!--HEAD-->", `
|
||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||
<meta name="google-signin-client_id" content="${gGlobalSettings['google-signin-client_id']}">`);
|
||||
}
|
||||
data = data.replace("$(VIEW_SOURCE)", "/~" + packageOwner + "/" + packageName + "/view");
|
||||
}
|
||||
data = data.replace("$(VIEW_SOURCE)", "/~" + packageOwner + "/" + packageName + "/view");
|
||||
data = new TextEncoder("UTF-8").encode(data);
|
||||
}
|
||||
var raw = new TextEncoder("UTF-8").encode(data);
|
||||
response.writeHead(200, {"Content-Type": kStaticFiles[i].type, "Content-Length": raw.length});
|
||||
response.end(raw);
|
||||
response.writeHead(200, {"Content-Type": kStaticFiles[i].type, "Content-Length": data.length});
|
||||
response.end(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user