File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ function PDF (html, options) {
36
36
if ( ! this . options . phantomPath ) this . options . phantomPath = phantomjs && phantomjs . path
37
37
this . options . phantomArgs = this . options . phantomArgs || [ ]
38
38
39
- if ( this . options . localUrlAccess ) this . options . phantomArgs . push ( '--local-url-access=false' )
39
+ if ( ! this . options . localUrlAccess ) this . options . phantomArgs . push ( '--local-url-access=false' )
40
40
assert ( this . options . phantomPath , "html-pdf: Failed to load PhantomJS module. You have to set the path to the PhantomJS binary using 'options.phantomPath'" )
41
41
assert ( typeof this . html === 'string' && this . html . length , "html-pdf: Can't create a pdf without an html string" )
42
42
this . options . timeout = parseInt ( this . options . timeout , 10 ) || 30000
Original file line number Diff line number Diff line change @@ -229,29 +229,29 @@ test('load with cookies js', function (t) {
229
229
} )
230
230
} )
231
231
232
- test ( 'allows local file access with localUrlAccess=true ' , function ( t ) {
232
+ test ( 'does not allow localUrlAccess by default ' , function ( t ) {
233
233
t . plan ( 2 )
234
234
235
235
pdf . create ( `
236
236
<body>here is an iframe which receives the cookies
237
237
<iframe src="file://${ path . join ( __dirname , 'multiple-pages.html' ) } " width="400" height="100"></iframe>
238
238
</body>
239
- ` , { localUrlAccess : true } )
239
+ ` )
240
240
. toBuffer ( function ( error , buffer ) {
241
241
t . error ( error )
242
242
const count = buffer . toString ( ) . match ( / \/ T y p e \/ P a g e \n / g) . length
243
243
t . assert ( count === 1 , 'Renders a page with 1 page as the content is missing' )
244
244
} )
245
245
} )
246
246
247
- test ( 'does not allow localUrlAccess by default ' , function ( t ) {
247
+ test ( 'allows local file access with localUrlAccess=true ' , function ( t ) {
248
248
t . plan ( 2 )
249
249
250
250
pdf . create ( `
251
251
<body>here is an iframe which receives the cookies
252
252
<iframe src="file://${ path . join ( __dirname , 'multiple-pages.html' ) } " width="400" height="100"></iframe>
253
253
</body>
254
- ` )
254
+ ` , { localUrlAccess : true } )
255
255
. toBuffer ( function ( error , buffer ) {
256
256
t . error ( error )
257
257
const count = buffer . toString ( ) . match ( / \/ T y p e \/ P a g e \n / g) . length
You can’t perform that action at this time.
0 commit comments