From 80a14a4911f16a15879d80fac71f6dc57be1059d Mon Sep 17 00:00:00 2001 From: Octavian Bujor Date: Fri, 18 May 2018 11:49:45 +0200 Subject: [PATCH] Removed old console logs and improvements. --- documentsdb/services/Documents.js | 11 +++-------- documentsdb/utils/backend_exist.js | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/documentsdb/services/Documents.js b/documentsdb/services/Documents.js index 306fa1b..8169e0e 100755 --- a/documentsdb/services/Documents.js +++ b/documentsdb/services/Documents.js @@ -56,11 +56,9 @@ var express = require('express'), path = require('path'), PassThrough = require('stream').PassThrough, - passport = require('passport'), - Boom = require('boom'); + passport = require('passport'); -var db = require('../utils/mongodb.js'), - secondary_backend = require('../utils/backend_exist'), +var secondary_backend = require('../utils/backend_exist'), main_backend = require('../utils/backend_fs'), FileToHtml = require('../converters/FileToHtml'), AknToEpub = require('../converters/AknToEpub'), @@ -149,10 +147,7 @@ router.get('*', function (req, res, next) { } else if (req.extension == 'pdf' && req.headers.accept == 'application/pdf') { getConvertedFile(new AknToPdf(), req.fileNoExtension); } else { - main_backend.getFile(res, req.dir, req.file, function (err) { - if (err == 404) res.status(404).end(); - else if (err) next(err); - }); + getFile(res, req.file); } }); diff --git a/documentsdb/utils/backend_exist.js b/documentsdb/utils/backend_exist.js index 1e4b912..066aa2a 100755 --- a/documentsdb/utils/backend_exist.js +++ b/documentsdb/utils/backend_exist.js @@ -82,7 +82,6 @@ exports.getDir = function (path, callback) { }); saxStream.on('end', function () { fileList.shift(); // Remove our collection name - console.log('filelist', fileList); if (res.statusCode != 200) callback(new Error('Eist GET DIR request has status code ' + res.statusCode)); else callback(undefined, fileList.map(decode_ls)); @@ -188,7 +187,6 @@ function encode_write(str) { } function decode_ls(str) { - console.log('str', str); return decodeURI( str.replace(encodedRegex, replaceEncoded) );