diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/response.js | 5 | ||||
-rw-r--r-- | lib/web/imageRouter/filesystem.js | 2 |
2 files changed, 5 insertions, 2 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 diff --git a/lib/web/imageRouter/filesystem.js b/lib/web/imageRouter/filesystem.js index 145876a9..4bf82b31 100644 --- a/lib/web/imageRouter/filesystem.js +++ b/lib/web/imageRouter/filesystem.js @@ -15,5 +15,5 @@ exports.uploadImage = function (imagePath, callback) { return } - callback(null, url.resolve(config.serverURL + '/', imagePath.match(/^public\/(.+$)/)[1])) + callback(null, url.resolve(config.serverURL + '/', imagePath.match(/public\/(.+)$/)[1])) } |