Fix WTVMime.js
This commit is contained in:
@@ -7,9 +7,9 @@ if (wtvshared.shenanigans.checkShenanigan(wtvshared.shenanigans.shenanigans.ENAB
|
||||
else url = "client:showalert?message=Please%20provide%20a%20%3Furl%3D%20with%20the%20url%20you%20would%20like%20to%20access.&buttonlabel1=Okay&buttonacction1=client:donothing"
|
||||
|
||||
headers = `300 OK
|
||||
wtv-visit: ${url}
|
||||
Location: ${url}
|
||||
Content-type: text/html`
|
||||
wtv-visit: ${url}
|
||||
Location: ${url}
|
||||
Content-type: text/html`
|
||||
} else {
|
||||
const err = wtvshared.doErrorPage(403, "Access Denied");
|
||||
headers = err[0];
|
||||
|
||||
@@ -7,6 +7,7 @@ class WTVMime {
|
||||
mime = require('mime-types');
|
||||
wtvshared = null;
|
||||
minisrv_config = [];
|
||||
|
||||
constructor(minisrv_config) {
|
||||
const { WTVShared } = require("./WTVShared.js");
|
||||
this.minisrv_config = minisrv_config;
|
||||
@@ -311,12 +312,12 @@ class WTVMime {
|
||||
|
||||
const delimiter = CRLF + '--' + boundary;
|
||||
const closeDelimiter = delimiter + '--';
|
||||
|
||||
const self = this;
|
||||
const encapsulations = tuples.map(function (tuple, i) {
|
||||
const mimetype = tuple.mime || 'text/plain';
|
||||
const encoding = tuple.encoding || 'utf-8';
|
||||
const use_base64 = tuple.use_base64 || !this.wtvshared.isASCII(tuple.content);
|
||||
const is_base64 = tuple.is_base64 || this.wtvshared.isBase64(tuple.content);
|
||||
const use_base64 = tuple.use_base64 || !self.wtvshared.isASCII(tuple.content);
|
||||
const is_base64 = tuple.is_base64 || self.wtvshared.isBase64(tuple.content);
|
||||
const filename = (tuple.filename) ? tuple.filename : (use_base64) ? ('file' + i) : null;
|
||||
|
||||
const headers = [
|
||||
@@ -327,8 +328,8 @@ class WTVMime {
|
||||
headers.push(`Content-Transfer-Encoding: ${(use_base64) ? 'base64' : '7bit'}`);
|
||||
|
||||
let bodyPart = headers.join(CRLF) + CRLF + CRLF;
|
||||
if (use_base64 && !is_base64) bodyPart += this.wtvshared.lineWrap(Buffer.from(tuple.content).toString('base64'),72) + CRLF;
|
||||
else bodyPart += this.wtvshared.lineWrap(tuple.content,72);
|
||||
if (use_base64 && !is_base64) bodyPart += self.wtvshared.lineWrap(Buffer.from(tuple.content).toString('base64'),72) + CRLF;
|
||||
else bodyPart += self.wtvshared.lineWrap(tuple.content,72);
|
||||
|
||||
return delimiter + CRLF + bodyPart;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user