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,7 +237,9 @@ async function handler(request, response, packageOwner, packageName, uri) {
|
|||||||
for (var i in kStaticFiles) {
|
for (var i in kStaticFiles) {
|
||||||
if (uri === kStaticFiles[i].uri) {
|
if (uri === kStaticFiles[i].uri) {
|
||||||
found = true;
|
found = true;
|
||||||
var data = new TextDecoder("UTF-8").decode(File.readFile("core/" + kStaticFiles[i].path));
|
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 (kStaticFiles[i].uri == "") {
|
||||||
if (gGlobalSettings && gGlobalSettings['google-signin-client_id']) {
|
if (gGlobalSettings && gGlobalSettings['google-signin-client_id']) {
|
||||||
data = data.replace("<!--HEAD-->", `
|
data = data.replace("<!--HEAD-->", `
|
||||||
@ -246,9 +248,10 @@ async function handler(request, response, packageOwner, packageName, uri) {
|
|||||||
}
|
}
|
||||||
data = data.replace("$(VIEW_SOURCE)", "/~" + packageOwner + "/" + packageName + "/view");
|
data = data.replace("$(VIEW_SOURCE)", "/~" + packageOwner + "/" + packageName + "/view");
|
||||||
}
|
}
|
||||||
var raw = new TextEncoder("UTF-8").encode(data);
|
data = 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user