Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/node/handler/ImportHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,6 @@ async function doImport(req, res, padId)
}
}

if (!useConvertor && !req.directDatabaseAccess) {
// Read the file with no encoding for raw buffer access.
let buf = await fsp_readFile(destFile);

// Check if there are only ascii chars in the uploaded file
let isAscii = ! Array.prototype.some.call(buf, c => (c > 240));

if (!isAscii) {
throw "uploadFailed";
}
}

// get the pad object
let pad = await padManager.getPad(padId);

Expand All @@ -192,6 +180,9 @@ async function doImport(req, res, padId)
if (!req.directDatabaseAccess) {
text = await fsp_readFile(destFile, "utf8");

let bytelike = unescape(encodeURIComponent(text));
text = decodeURIComponent(escape(bytelike));

/*
* The <title> tag needs to be stripped out, otherwise it is appended to the
* pad.
Expand Down