Skip to content

Commit c8accde

Browse files
committed
Fixes file saving in formatData.
Previously, `formatData` did not correctly handle cases when the returned content was binary in nature but was not a `Buffer` instance. This led to bugs such as failures when running: `npx webpagetest waterfall <test_id> -o out.png -k <key>` I'm not sure this patch is 100% correct, as the tests require Docker and that isn't running on my current device.
1 parent 7be9af9 commit c8accde

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/webpagetest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ var formatData = function(err, data, info) {
5959
}
6060

6161
if (file) {
62-
fs.writeFile(file, dataStr, encoding, function writeFile(err) {
62+
fs.writeFile(file, (dataStr || data), encoding, function writeFile(err) {
6363
if (err) {
6464
output(err.message, 1);
6565
}
6666
});
6767
} else {
68-
output(dataStr, err ? 1 : 0);
68+
output((dataStr || data), err ? 1 : 0);
6969
}
7070

7171
return data;

0 commit comments

Comments
 (0)