Fix test error

This commit is contained in:
Miguel González Aravena 2017-08-15 04:34:00 -03:00
parent 908d137a04
commit 0c48e20d88
1 changed files with 16 additions and 14 deletions

View File

@ -124,22 +124,24 @@ FileSystemProvider.prototype.getContainers = function(cb) {
FileSystemProvider.prototype.createContainer = function(options, cb) {
var self = this;
var name = options.name;
var hasSlash = (typeof name == 'string' ? name.search('%2F') : false);
var hasSlash = name.search('%2F');
name = (hasSlash != -1 ? name.replace(/%2F/gi, '/') : name);
var dir = path.join(this.root, name);
validateName(name, cb) && fs.mkdir(dir, options, function(err) {
if (err) {
return cb && cb(err);
mkdirp(dir, function(err) {
if(err) {
cb(err);
} else {
fs.stat(dir, function(err, stat) {
var container = null;
if(!err) {
var props = { name: name };
populateMetadata(stat, props);
container = new Container(self, props);
}
cb(err, container);
});
}
fs.stat(dir, function(err, stat) {
var container = null;
if (!err) {
var props = {name: name};
populateMetadata(stat, props);
container = new Container(self, props);
}
cb && cb(err, container);
});
});
};
@ -182,7 +184,7 @@ FileSystemProvider.prototype.getContainer = function(containerName, cb) {
// File related functions
FileSystemProvider.prototype.upload = function(options, cb) {
var container = options.container;
var hasSlash = (typeof container == 'string' ? container.search('%2F') : false);
var hasSlash = container.search('%2F');
container = (hasSlash != -1 ? container.replace(/%2F/gi, '/') : container);
var file = options.remote;
if (!validateName(file)) {