Skip to content

Commit f88cd01

Browse files
committed
Fix tmp directory path
1 parent 891b9e5 commit f88cd01

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/scripts/pdf_a4_portrait.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ page.onLoadFinished = function (status) {
6262
quality: options.quality || 75
6363
}
6464

65-
var filename = options.filename || (options.directory || '/tmp' + '/html-pdf-' + system.pid + '.' + fileOptions.type)
65+
var filename = options.filename || (options.directory || '/tmp') + '/html-pdf-' + system.pid + '.' + fileOptions.type
6666
page.render(filename, fileOptions)
6767
system.stdout.write(JSON.stringify({filename: filename}))
6868

test/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ test('pdf.create(html[, options]).toFile([filename, ]callback)', function (t) {
5353
})
5454
})
5555

56-
test('pdf.create(html[, options]).toBuffer(callback)', function (t) {
56+
test('pdf.create(html).toBuffer(callback)', function (t) {
5757
t.plan(3)
5858

5959
pdf.create(html).toBuffer(function (err, pdf) {
@@ -63,6 +63,15 @@ test('pdf.create(html[, options]).toBuffer(callback)', function (t) {
6363
})
6464
})
6565

66+
test('pdf.create(html, {directory: "/tmp"}).toBuffer(callback)', function (t) {
67+
t.plan(2)
68+
69+
pdf.create(html, {directory: '/tmp'}).toBuffer(function (err, pdf) {
70+
t.error(err)
71+
t.assert(Buffer.isBuffer(pdf), "uses the passed directory as tmp dir")
72+
})
73+
})
74+
6675
test('pdf.create(html[, options]).toStream(callback)', function (t) {
6776
t.plan(3)
6877

0 commit comments

Comments
 (0)