Verificar que nombre de Contenedor es un string
This commit is contained in:
parent
71e0d5255f
commit
46e681dd47
|
@ -124,6 +124,8 @@ FileSystemProvider.prototype.getContainers = function(cb) {
|
||||||
FileSystemProvider.prototype.createContainer = function(options, cb) {
|
FileSystemProvider.prototype.createContainer = function(options, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var name = options.name;
|
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);
|
var dir = path.join(this.root, name);
|
||||||
validateName(name, cb) && fs.mkdir(dir, options, function(err) {
|
validateName(name, cb) && fs.mkdir(dir, options, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -180,12 +182,8 @@ FileSystemProvider.prototype.getContainer = function(containerName, cb) {
|
||||||
// File related functions
|
// File related functions
|
||||||
FileSystemProvider.prototype.upload = function(options, cb) {
|
FileSystemProvider.prototype.upload = function(options, cb) {
|
||||||
var container = options.container;
|
var container = options.container;
|
||||||
if (!validateName(container)) {
|
var hasSlash = (typeof container == 'string' ? container.search('%2F') : false);
|
||||||
return writeStreamError(
|
container = (hasSlash != -1 ? container.replace(/%2F/gi, '/') : container);
|
||||||
new Error(g.f('{{FileSystemProvider}}: Invalid name: %s', container)),
|
|
||||||
cb
|
|
||||||
);
|
|
||||||
}
|
|
||||||
var file = options.remote;
|
var file = options.remote;
|
||||||
if (!validateName(file)) {
|
if (!validateName(file)) {
|
||||||
return writeStreamError(
|
return writeStreamError(
|
||||||
|
|
Loading…
Reference in New Issue