1
0
Fork 0
This commit is contained in:
Alan Plum 2018-08-15 11:54:53 +02:00 committed by Jan
parent ddd7a5b482
commit d56fdf3b84
3 changed files with 23 additions and 1 deletions

View File

@ -3,6 +3,9 @@ v3.3.14 (2018-08-15)
* upgraded arangodb starter version to 0.13.1
* fixed issue #5736: Foxx HTTP API responds with 500 error when request body
is too short
* fixed issue #5831: custom queries in the ui could not be loaded if the user
only has read access to the _system database.

View File

@ -218,5 +218,5 @@ exports.jsonml2xml = function (jsonml, html = false, indentLevel = 0) {
};
exports.isZipBuffer = function (buffer) {
return buffer instanceof Buffer && buffer.utf8Slice(0, 4) === 'PK\u0003\u0004';
return buffer instanceof Buffer && buffer.length >= 4 && buffer.utf8Slice(0, 4) === 'PK\u0003\u0004';
};

View File

@ -0,0 +1,19 @@
"use strict";
const util = require("@arangodb/util");
const { expect } = require("chai");
describe("isZipBuffer", () => {
const { isZipBuffer } = util;
it("handles empty buffers", () => {
const buf = new Buffer(0);
expect(isZipBuffer(buf)).to.equal(false);
});
it("recognizes zip buffers", () => {
const buf = new Buffer("PK\u0003\u0004");
expect(isZipBuffer(buf)).to.equal(true);
});
it("does not recognize non-zip buffers", () => {
const buf = new Buffer("PK\u0000\u0004");
expect(isZipBuffer(buf)).to.equal(false);
});
});