summaryrefslogtreecommitdiff
path: root/lib/response.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/response.js')
-rw-r--r--lib/response.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/response.js b/lib/response.js
index 335f1000..d1e5e15c 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -329,15 +329,18 @@ function actionInfo (req, res, note) {
}
function actionPDF (req, res, note) {
+ var url = config.serverURL || 'http://' + req.get('host')
var body = note.content
var extracted = models.Note.extractMeta(body)
+ var content = extracted.markdown
var title = models.Note.decodeTitle(note.title)
if (!fs.existsSync(config.tmpPath)) {
fs.mkdirSync(config.tmpPath)
}
var path = config.tmpPath + '/' + Date.now() + '.pdf'
- markdownpdf().from.string(extracted.markdown).to(path, function () {
+ content = content.replace(/\]\(\//g, '](' + url + '/')
+ markdownpdf().from.string(content).to(path, function () {
var stream = fs.createReadStream(path)
var filename = title
// Be careful of special characters