Skip to content

Commit

Permalink
FiltToHtml service added the possibility to specify what cleanXsl fil…
Browse files Browse the repository at this point in the history
…e to use
  • Loading branch information
obujor committed Apr 4, 2017
1 parent 1a81cad commit 68c0306
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion documentsdb/services/FileToHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ var express = require('express'),
path = require('path'),
lngDetector = new (require('languagedetect')),
striptags = require('striptags'),
langs = require('langs');
langs = require('langs'),
fs = require('fs');

var FileToHtml = require('../converters/FileToHtml.js'),
XsltTransform = require('../../xml/xml/XsltTransform.js'),
Expand Down Expand Up @@ -86,6 +87,15 @@ router.post('/', function (req, res, next) {
if (!isAllowed(file.mimetype)) {
next(Boom.badRequest(file.mimetype+' files are not supported!'));
}

var cleanXsl = req.body.cleanXsl;
if (cleanXsl && cleanXsl.length > 0) {
cleanXsl = path.resolve(__dirname, '..', 'xslt/'+cleanXsl);
if (fs.existsSync(cleanXsl)) {
clearHtmlPath = cleanXsl;
}
}

if (isXml(file.mimetype)) {
FileCache.getFilePath(req.body.transformFile, function(err, xslt) {
if (err) next(Boom.badRequest(err));
Expand Down

0 comments on commit 68c0306

Please sign in to comment.