Commit 0001c14b authored by taivo's avatar taivo
Browse files

KEEL-66: archive extractor improvements - extract only text files

parent fb0e7ac3
......@@ -17,9 +17,11 @@
"is-gzip": "^1.0.0",
"is-tar": "^1.0.0",
"is-zip": "^1.0.0",
"istextorbinary": "^1.0.2",
"jade": "~1.9.2",
"log4js": "^0.6.26",
"mime": "^1.3.4",
"mkdirp": "~0.5.0",
"morgan": "~1.5.3",
"multer": "0.1.6",
"node-schedule": "^0.2.9",
......@@ -30,8 +32,7 @@
"request": "^2.57.0",
"rimraf": "^2.4.0",
"tar": "^2.1.1",
"unzip": "^0.1.11",
"mkdirp": "~0.5.0"
"unzip": "^0.1.11"
},
"devDependencies": {
"assert": "^1.3.0",
......
......@@ -13,6 +13,7 @@ var isTar = require('is-tar');
var zlib = require('zlib');
var tar = require('tar');
var recursiveReaddir = require('recursive-readdir');
var isTextOrBinary = require('istextorbinary');
function ArchiveExtractor() {
var self = this;
......@@ -64,7 +65,7 @@ function ArchiveExtractor() {
return callback(err, session);
}
if (isFile) {
if (isFile && isTextOrBinary.isTextSync(entry.path)) {
var uniqid = randomstring.generate(10);
var filePath = path.join(directory, uniqid);
//logger.debug('Filepath: ' + filePath);
......
......@@ -217,7 +217,29 @@ config.availableWappers = {
id: 'uzip',
port: 3007,
class: 'archiveExtractor',
requestConf: simpleCommandRequest
requestConf: {
requestBodyTemplate: {
//isAsync: null
},
requestBodyParamsMappings: {
//isAsync: {
// usageType: config.paramUsageTypes.META,
// filter: function(value){
// return value == 1;
// },
// required: true,
// allowEmpty: false,
// validator: function(value, request){ return true; }
//}
},
requestFiles: {
content: null
},
staticParams: {
sessionMaxLifetime: 600,
isAsync: 0
}
}
},
TOKENIZER : {
title: 'Sõnestaja',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment