MathieuLoutre / grunt-aws-s3

Grunt plugin to interact with AWS S3 using the AWS SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`params` in the file list is ignored

evanhuang8 opened this issue · comments

It seems that the per file params is not respected. For the following code:

     prod:
        options:
          bucket: 'some-bucket'
          differential: true
          access: 'public-read'
          gzipRename: 'ext'
        files: [
          expand: true
          cwd: 'temp/static/'
          src: ['**/*']
          dest: '/'
        ,
          src: [
            'temp/static/js/app.*.js'
            'temp/static/js/libraries.*.js'
          ]
          dest: '/js/'
          params:
            CacheControl: '3600'
        ]

The cache control is not set on S3, however, when I move the params into the options part, it will set the cache control for all files in the file list. Any thoughts?

That's quite strange. If you look at L298, it's definitely trying to read from there.
Could you try adding a params that's not allowed?

params:
     TestParam: '360'

L294/295 should throw. If so, then L298 should also work. What do you think?
Maybe try logging filePair.params after L298 to see the object. If the params are in there, then they should be applied (unless there's a bug down the road).

I'm also having this problem.

{
  options : {
    params : {
      ContentEncoding : 'gzip',
      CacheControl : 'max-age=86400'
    },
    accessKeyId : '<%= AWSAccessKeyId %>',
    secretAccessKey : '<%= AWSSecretKey %>',
    bucket : '<%= s3_bucket %>',
    differential : true
  },
  redirect : {
    options : {
      params : {
        WebsiteRedirectLocation : '/<%= path %>',
        ContentType: 'text/plain'
      }
    },
    files : [
      {
        action : 'upload',
        expand : true,
        cwd : 'dist',
        src : [ 'redirect.html' ],
        dest : '<%= path %>/'
      }
    ]
  }
}

The WebsiteRedirectLocation and ContentType params have no effect.