From 95971444223152c72cc72927d96ae11d31f2c64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Gonz=C3=A1lez=20Aravena?= Date: Tue, 15 Aug 2017 03:46:20 -0300 Subject: [PATCH] Verify Container's name is a string --- lib/providers/filesystem/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/providers/filesystem/index.js b/lib/providers/filesystem/index.js index a941587..6dcc5fd 100644 --- a/lib/providers/filesystem/index.js +++ b/lib/providers/filesystem/index.js @@ -124,6 +124,8 @@ 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); + 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) { @@ -180,12 +182,8 @@ FileSystemProvider.prototype.getContainer = function(containerName, cb) { // File related functions FileSystemProvider.prototype.upload = function(options, cb) { var container = options.container; - if (!validateName(container)) { - return writeStreamError( - new Error(g.f('{{FileSystemProvider}}: Invalid name: %s', container)), - cb - ); - } + var hasSlash = (typeof container == 'string' ? container.search('%2F') : false); + container = (hasSlash != -1 ? container.replace(/%2F/gi, '/') : container); var file = options.remote; if (!validateName(file)) { return writeStreamError(