Potential rewrite of same change. seeking review
@humphd the change you asked for said to rule out undefined, but now that I think about it, isn't the fact that it is undefined the problem? The object has no such attribute, and thats why it breaks. I have written a new way of checking this and would like your opinion on it. I could just undone the == -> === change but I expect that there might be a good reason not to do that.
This commit is contained in:
parent
df57e35500
commit
7ad1312830
|
@ -1870,12 +1870,17 @@ function appendFile(fs, context, path, data, options, callback) {
|
|||
if(!flags) {
|
||||
return callback(new Errors.EINVAL('flags is not valid', path));
|
||||
}
|
||||
|
||||
if (typeof options === 'object' && options.encoding === undefined ) {
|
||||
options.encoding = 'utf8';
|
||||
}
|
||||
|
||||
data = data || '';
|
||||
if(typeof data === 'number') {
|
||||
data = '' + data;
|
||||
}
|
||||
if(typeof data === 'string' && (options.encoding === null || options.encoding === 'utf8')) {
|
||||
|
||||
if(typeof data === 'string' && options.encoding === 'utf8') {
|
||||
data = Encoding.encode(data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue