Working null byte patch checks
This commit is contained in:
parent
77f32c4c50
commit
b7733a591d
|
@ -8866,6 +8866,10 @@ define('src/fs',['require','lodash','encoding-indexes','encoding','src/path','sr
|
||||||
callback(new EInvalid('flags is not valid'));
|
callback(new EInvalid('flags is not valid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = data || '';
|
||||||
|
if(typeof data === "number") {
|
||||||
|
data = '' + data;
|
||||||
|
}
|
||||||
if(typeof data === "string" && options.encoding === 'utf8') {
|
if(typeof data === "string" && options.encoding === 'utf8') {
|
||||||
data = new TextEncoder('utf-8').encode(data);
|
data = new TextEncoder('utf-8').encode(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1317,6 +1317,10 @@ define(function(require) {
|
||||||
callback(new EInvalid('flags is not valid'));
|
callback(new EInvalid('flags is not valid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = data || '';
|
||||||
|
if(typeof data === "number") {
|
||||||
|
data = '' + data;
|
||||||
|
}
|
||||||
if(typeof data === "string" && options.encoding === 'utf8') {
|
if(typeof data === "string" && options.encoding === 'utf8') {
|
||||||
data = new TextEncoder('utf-8').encode(data);
|
data = new TextEncoder('utf-8').encode(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,9 @@ describe("node.js tests from https://github.com/joyent/node/blob/master/test", f
|
||||||
check(fs.symlink, 'foo\u0000bar', 'foobar');
|
check(fs.symlink, 'foo\u0000bar', 'foobar');
|
||||||
check(fs.symlink, 'foobar', 'foo\u0000bar');
|
check(fs.symlink, 'foobar', 'foo\u0000bar');
|
||||||
check(fs.unlink, 'foo\u0000bar');
|
check(fs.unlink, 'foo\u0000bar');
|
||||||
check(fs.writeFile, 'foo\u0000bar');
|
// NOTE: the node.js test doesn't pass anything for the data arg
|
||||||
|
// but this just seems wrong based on their docs. Here I use one.
|
||||||
|
check(fs.writeFile, 'foo\u0000bar', 'foobar');
|
||||||
// TODO - need to be implemented still...
|
// TODO - need to be implemented still...
|
||||||
// check(fs.appendFile, 'foo\u0000bar');
|
// check(fs.appendFile, 'foo\u0000bar');
|
||||||
// check(fs.realpath, 'foo\u0000bar');
|
// check(fs.realpath, 'foo\u0000bar');
|
||||||
|
|
Loading…
Reference in New Issue