Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions routes/dms.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@ module.exports = function () {
// Prep text views - load first 10Kb of a file to 'content' attribut which
// we can render as is in the template.
datapackage.displayResources = await Promise.all(datapackage.displayResources.map(async item => {
await Promise.all(item.resource.views.map(async (view, index) => {
if (view && view.specType === 'text' && item.resource.path) {
item.resource.views[index].content = await fetchTextContent(item.resource.path)
}
}))
if (item.resource.views) {
await Promise.all(item.resource.views.map(async (view, index) => {
if (view && view.specType === 'text' && item.resource.path) {
item.resource.views[index].content = await fetchTextContent(item.resource.path)
}
}))
}
return item
}))

Expand Down
5 changes: 3 additions & 2 deletions utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ const winston = require('winston')
const config = require('../config/index')

const customFormat = winston.format.printf((info) => {
const { level, message, ...meta } = info
return `${meta.timestamp} [${level}] ${message}`
const { level, message, stack, ...meta } = info
return `${meta.timestamp} [${level}] ${message}${stack ? '\n' + stack : ''}`
})

const logger = winston.createLogger({
level: config.get('LOG_LEVEL') || 'info',
format: winston.format.combine(
winston.format.errors({ stack: true }),
winston.format.json(),
winston.format.timestamp(),
winston.format.colorize(),
Expand Down