Исправление бага распаковки Zip-архивов с плохими именами файлов

This commit is contained in:
Book Pauk
2020-10-13 16:24:35 +07:00
parent 2e58cfdb75
commit 39e14d70ee
3 changed files with 17 additions and 3 deletions

View File

@@ -766,7 +766,7 @@ ZipEntry.prototype.readDataHeader = function(data) {
};
ZipEntry.prototype.read = function(data, offset) {
this.nameRaw = data.slice(offset, offset += this.fnameLen);
this.nameRaw = Buffer.from(data.slice(offset, offset += this.fnameLen));
this.name = this.nameRaw.toString();
var lastChar = data[offset - 1];
this.isDirectory = (lastChar == 47) || (lastChar == 92);