vinyl-fs icon indicating copy to clipboard operation
vinyl-fs copied to clipboard

Binary stream corruption fix

Open PRR24 opened this issue 1 year ago • 5 comments

Addresses https://github.com/gulpjs/gulp/issues/2803

PRR24 avatar May 30 '24 19:05 PRR24

Seems related to https://github.com/gulpjs/vinyl-fs/issues/351

Daniel-Sh-uq avatar Jun 03 '24 10:06 Daniel-Sh-uq

I think that the test should be the same as this test by just removing "encoding: false".

nicolashenry avatar Jun 18 '24 10:06 nicolashenry

This fix seems "obviously" correct -- somehow this typo sneaked through the whole vetting or there was some merging weirdness. But I don't yet understand why this branch of the code was never reached by the tests. It's been a long time since I looked at this and there's some things I don't recognize (such as a suite of stream backends, is that right?) It would be good to have a bunch of failing tests in the old (current) situation which this PR then fixes.

erikkemperman avatar Jul 17 '24 18:07 erikkemperman

There are currently no e2e binary stream tests. Here is the example of failing test, please add to the most suitable test file.

  it('should not destroy binary file', function (done) {
    var ranBomInputPath = path.join(testConstants.inputBase, './ranbom.bin');
    var ranBomOutputPath = path.join(testConstants.outputBase, './ranbom.bin');

    function assert(files) {
      var srcResult = fs.readFileSync(ranBomInputPath, null);
      var destResult = fs.readFileSync(ranBomOutputPath, null);
      expect(srcResult).toEqual(destResult);
    }

    pipeline(
      [
        vfs.src(ranBomInputPath, { encoding: false, buffer: false }),
        vfs.dest(testConstants.outputBase),
        concatArray(assert),
      ],
      done
    );
  });

PRR24 avatar Jul 17 '24 19:07 PRR24

Gentle ping, any progress on this?

woody-li avatar Aug 21 '24 08:08 woody-li