brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 286 forks source link

phantomjs not spawned correctly if url have multiple parameters joined with & #228

Open blazekas opened 6 years ago

blazekas commented 6 years ago

On windows phantomjs process is not spawned correctly if url have multiple parameters joined with & -

`var webshot = require('webshot');

webshot('http://localhost:3000/?script=5a7470bbadf5ae26ccfcc100&page=5a7470bbadf5ae26ccfcc0dc', './localhost.png', { "cookies": [{ "name": "connect.sid", "value": "s:PDkhVICmVM5iEBa4uT7SSqX919h76Um_.4s0voVhbO1ZMKJus4lBQHC+ayZX1hkTjt1XEtZJDuDE", "domain": "localhost", "path": "/" } ] }, function (err) { if (err) { return console.log(err); } console.log('OK'); }); `

Process explorer shows that JSON passed to phantomjs is cut at & symbol - "D:\Tests\webshot\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe" "D:\Tests\webshot\nodemodules\webshot\lib/webshot.phantom.js" "{\"windowSize\":{\"width\":1024,\"height\":768},\"shotSize\":{\"width\":\"window\",\"height\":\"window\"},\"shotOffset\":{\"left\":0,\"right\":0,\"top\":0,\"bottom\":0},\"streamType\":\"png\",\"siteType\":\"url\",\"quality\":75,\"cookies\":[{\"name\":\"connect.sid\",\"value\":\"s:PDkhVICmVM5iEBa4uT7SSqX919h76Um.4s0voVhbO1ZMKJus4lBQHC+ayZX1hkTjt1XEtZJDuDE\",\"domain\":\"localhost\",\"path\":\"/\"}],\"zoomFactor\":1,\"site\":\"http://localhost:3000/?script=5a7470bbadf5ae26ccfcc100

This was not a problem in earlier releases when path and site were passed as separate arguments not part of the json.

tylerhammer commented 5 years ago

Did you ever figure out a way around this?