This commit is contained in:
parent
16dfb79de9
commit
f451ed96cc
|
@ -1550,10 +1550,13 @@ function validate_file_options(options, enc, fileMode){
|
|||
|
||||
function pathCheck(path, callback) {
|
||||
var err;
|
||||
if(isNullPath(path)) {
|
||||
|
||||
if(!path) {
|
||||
err = new Errors.EINVAL('Path must be a string', path);
|
||||
} else if(isNullPath(path)) {
|
||||
err = new Errors.EINVAL('Path must be a string without null bytes.', path);
|
||||
} else if(!isAbsolutePath(path)) {
|
||||
err = new Errors.EINAVL('Path must be absolute.', path);
|
||||
err = new Errors.EINVAL('Path must be absolute.', path);
|
||||
}
|
||||
|
||||
if(err) {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
var Filer = require('../..');
|
||||
var util = require('../lib/test-utils.js');
|
||||
var expect = require('chai').expect;
|
||||
|
||||
describe('undefined and relative paths, issue270', function() {
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should fail with EINVAL when called on an undefined path', function(done) {
|
||||
var fs = util.fs();
|
||||
|
||||
fs.writeFile(undefined, 'data', function(err) {
|
||||
expect(err).to.exist;
|
||||
expect(err.code).to.equal('EINVAL');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail with EINVAL when called on a relative path', function(done) {
|
||||
var fs = util.fs();
|
||||
|
||||
fs.writeFile('relpath/file.txt', 'data', function(err) {
|
||||
expect(err).to.exist;
|
||||
expect(err.code).to.equal('EINVAL');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -75,3 +75,4 @@ require("./bugs/issue247.js");
|
|||
require("./bugs/issue254.js");
|
||||
require("./bugs/issue258.js");
|
||||
require("./bugs/issue267.js");
|
||||
require("./bugs/issue270.js");
|
||||
|
|
Loading…
Reference in New Issue