clineamb / gulp-s3-upload

A gulp task to upload/update assets to an S3 account.
62 stars 37 forks source link

maps - shared mutable options #26

Closed iofjuupasli closed 9 years ago

iofjuupasli commented 9 years ago
gulp.src('./**')
  .pipe(s3({
    maps: {
      ContentDisposition: function (keyname) { return keyname; }
    }
  }));

It send files with value from latest file. Probably because it overrides options.ContentDisposition on each file.

The solution might be to make a copy of options for each file.

clineamb commented 9 years ago

I don't seem to understand what the exact problem is in particular. Can you elaborate a bit more?

iofjuupasli commented 9 years ago

One of files which I upload to S3 named fileOne. So ContentDisposition should be fileOne. But on S3 I see Content-Disposition is fileTwo, which also uploading to S3.

Hope this information is enough.

But also after quick research in code I found this line https://github.com/clineamb/gulp-s3-upload/blob/master/index.js#L133 which makes mutation to shared object. And then async task execution: https://github.com/clineamb/gulp-s3-upload/blob/master/index.js#L155

I'm not sure whether it is the reason of bug.

clineamb commented 9 years ago

Ah, gotcha. This is probably the reason. I'll just move the maps into there -- that should fix it.

clineamb commented 9 years ago

https://github.com/clineamb/gulp-s3-upload/commit/1831deca4b9d362c651956490553ffdedca009b4

This latest commit should be the fix.