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) {
3636 if ( ! this . options . phantomPath ) this . options . phantomPath = phantomjs && phantomjs . path
3737 this . options . phantomArgs = this . options . phantomArgs || [ ]
3838
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' )
4040 assert ( this . options . phantomPath , "html-pdf: Failed to load PhantomJS module. You have to set the path to the PhantomJS binary using 'options.phantomPath'" )
4141 assert ( typeof this . html === 'string' && this . html . length , "html-pdf: Can't create a pdf without an html string" )
4242 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) {
229229 } )
230230} )
231231
232- test ( 'allows local file access with localUrlAccess=true ' , function ( t ) {
232+ test ( 'does not allow localUrlAccess by default ' , function ( t ) {
233233 t . plan ( 2 )
234234
235235 pdf . create ( `
236236 <body>here is an iframe which receives the cookies
237237 <iframe src="file://${ path . join ( __dirname , 'multiple-pages.html' ) } " width="400" height="100"></iframe>
238238 </body>
239- ` , { localUrlAccess : true } )
239+ ` )
240240 . toBuffer ( function ( error , buffer ) {
241241 t . error ( error )
242242 const count = buffer . toString ( ) . match ( / \/ T y p e \/ P a g e \n / g) . length
243243 t . assert ( count === 1 , 'Renders a page with 1 page as the content is missing' )
244244 } )
245245} )
246246
247- test ( 'does not allow localUrlAccess by default ' , function ( t ) {
247+ test ( 'allows local file access with localUrlAccess=true ' , function ( t ) {
248248 t . plan ( 2 )
249249
250250 pdf . create ( `
251251 <body>here is an iframe which receives the cookies
252252 <iframe src="file://${ path . join ( __dirname , 'multiple-pages.html' ) } " width="400" height="100"></iframe>
253253 </body>
254- ` )
254+ ` , { localUrlAccess : true } )
255255 . toBuffer ( function ( error , buffer ) {
256256 t . error ( error )
257257 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