From 6c682875a088ba62dd591374d29867cc55c2abc9 Mon Sep 17 00:00:00 2001 From: Joan Date: Mon, 3 Sep 2018 13:54:18 +0200 Subject: [PATCH] mailer css removed justify text. Fixed chrome image content-type. --- client/client/src/sample/create/index.html | 2 +- services/mailer/application/router.js | 21 ++++++++++++++++++++- services/mailer/static/css/component.css | 4 ---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/client/client/src/sample/create/index.html b/client/client/src/sample/create/index.html index 8fdcce50c..744ef02f1 100644 --- a/client/client/src/sample/create/index.html +++ b/client/client/src/sample/create/index.html @@ -14,7 +14,7 @@ vn-id="sampleType" field="$ctrl.clientSample.typeFk" model="ClientSample.typeFk" - select-fields="['id','description','code','hasCompany']" + select-fields="['code','hasCompany']" url="/client/api/Samples" show-field="description" value-field="id" diff --git a/services/mailer/application/router.js b/services/mailer/application/router.js index 161271820..c8e32b564 100644 --- a/services/mailer/application/router.js +++ b/services/mailer/application/router.js @@ -20,11 +20,30 @@ router.use('/static/:template/:image', function(request, response) { return response.json({message: 'Image not found'}); let readStream = fs.createReadStream(imagePath); - + readStream.on('open', function() { + let contentType = getContentType(imagePath); + + if (contentType) + response.setHeader('Content-type', getContentType(imagePath)); + readStream.pipe(response); }); }); }); +function getContentType(path) { + let types = { + png: 'image/png', + svg: 'image/svg+xml', + gif: 'image/gif', + jpeg: 'image/jpeg', + jpg: 'image/jpeg' + }; + + let extension = path.split('.')[1]; + + return types[extension]; +} + module.exports = router; diff --git a/services/mailer/static/css/component.css b/services/mailer/static/css/component.css index b4c018d79..2621048c3 100644 --- a/services/mailer/static/css/component.css +++ b/services/mailer/static/css/component.css @@ -7,10 +7,6 @@ img { margin: 0 } -p { - text-align: justify -} - .wrapper { background-color: #EEE }