zeanium-node
Advanced tools
Comparing version 0.6.27 to 0.6.28
{ | ||
"name": "zeanium-node", | ||
"version": "0.6.27", | ||
"version": "0.6.28", | ||
"description": "Zeanium for Node.js, simple http server and custome your business.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,2 +43,6 @@ /** | ||
__getUploadInfo: function (){ | ||
if(!this.config.upload && !this.serverContext.config.upload){ | ||
return; | ||
} | ||
var _uploadConfig = zn.extend({ | ||
@@ -53,15 +57,16 @@ root: this.config.root, | ||
_catalog = node_path.join(_uploadConfig.root, _uploadConfig.catalog), | ||
_path = null; | ||
_path = _uploadConfig.root; | ||
_uploadConfig.temp.split('/').map(function (value){ | ||
_path = node_path.join(_uploadConfig.root, value); | ||
_path = node_path.join(_path, value); | ||
if(value && !node_fs.existsSync(_path)){ | ||
node_fs.mkdirSync(_path); | ||
node_fs.mkdirSync(_path, 0766); | ||
} | ||
}); | ||
_path = _uploadConfig.root; | ||
_uploadConfig.catalog.split('/').map(function (value){ | ||
_path = node_path.join(_uploadConfig.root, value); | ||
_path = node_path.join(_path, value); | ||
if(value && !node_fs.existsSync(_path)){ | ||
node_fs.mkdirSync(_path); | ||
node_fs.mkdirSync(_path, 0766); | ||
} | ||
@@ -68,0 +73,0 @@ }); |
@@ -127,11 +127,9 @@ /** | ||
if(_reg && !_reg.test(_value)){ | ||
response.error('Value of http request parameter(\'' + _key + '\') is Invalid.'); | ||
return false; | ||
return response.error('Value of http request parameter(\'' + _key + '\') is Invalid.'), false; | ||
} | ||
break; | ||
case 'function': | ||
var _temp = _defaultValue(this.getValue(_key), this); | ||
if(_temp===false){ | ||
response.error('Value of http request parameter(\'' + _key + '\') is Invalid.'); | ||
return false; | ||
var _temp = _defaultValue(_newValue, this); | ||
if(typeof _temp == 'string'){ | ||
return response.error(_temp), false; | ||
} | ||
@@ -187,4 +185,6 @@ | ||
var _incomingForm = new formidable.IncomingForm(); | ||
//_incomingForm.keepExtensions = true; //使用文件的原扩展名 | ||
_incomingForm.uploadDir = this.applicationContext.uploadConfig.tempDir; | ||
if(this.applicationContext && this.applicationContext.uploadConfig){ | ||
_incomingForm.keepExtensions = this.applicationContext.uploadConfig.keepExtensions; //使用文件的原扩展名 | ||
_incomingForm.uploadDir = this.applicationContext.uploadConfig.tempDir; | ||
} | ||
_incomingForm.parse(_request,function(error, fields, files){ | ||
@@ -208,2 +208,7 @@ if(error){ | ||
uploadFile: function (file, uploadConfig){ | ||
if(!this.applicationContext || !this.applicationContext.uploadConfig){ | ||
throw new Error('applicationContext or applicationContext.uploadConfig is undefined.'); | ||
return; | ||
} | ||
var _name = file.path.split(path.sep).pop(), | ||
@@ -216,6 +221,2 @@ _ext = file.name.split('.').pop(), | ||
if(!fs.existsSync(_targetDir)){ | ||
fs.mkdirSync(_targetDir); | ||
} | ||
if(_uploadConfig.keepOriginName){ | ||
@@ -222,0 +223,0 @@ _file = file.name; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257649
6026