jpillora / grunt-aws

A Grunt interface into the Amazon Node.JS SDK
171 stars 44 forks source link

HTML file being uploaded as binary #50

Closed alana314 closed 9 years ago

alana314 commented 9 years ago

Hi, Thanks for this script. When I try running the s3 task, all of the files are uploaded fine except index.html, which is uploaded as a binary. Here is my config:

      s3: {
      options: {
        accessKeyId: "<%= aws.key %>",
        secretAccessKey: "<%= aws.secret %>",
        bucket: "pushtest"
      },
      build: {
        cwd: "dist/",
        src: "**"
      }
    }

When it runs, it uploads all the files, and index.html has the proper content-type of text/html in the s3 dashboard, but it looks like gobbledygook in the browser and when I download it in cyberduck it looks like binary.

jpillora commented 9 years ago

It's compressed using gzip, it seems as if cyberduck isn't decompressing it. If the consumers of your data aren't browsers (like cyberduck) then you might need to disable compression.

On Thu, Aug 13, 2015 at 11:13 AM, jordan314 notifications@github.com wrote:

Hi, Thanks for this script. When I try running the s3 task, all of the files are uploaded fine except index.html, which is uploaded as a binary. Here is my config: s3: { options: { accessKeyId: "<%= aws.key %>", secretAccessKey: "<%= aws.secret %>", bucket: "pushtest" }, build: { cwd: "dist/", src: "**" } }

When it runs, it uploads all the files, and index.html has the proper content-type of text/html in the s3 dashboard, but it looks like gobbledygook in the browser and when I download it in cyberduck it looks like binary.

— Reply to this email directly or view it on GitHub https://github.com/jpillora/grunt-aws/issues/50.

alana314 commented 9 years ago

Hi, Thanks for your fast response, you're right it was gzipped. The problem was my config, I was uploading to a dist/ folder instead of including from dist/. Second question: Does your script support multiple environments with arguments? With grunt-s3 we could run grunt s3:dev or grunt s3:prod to push to different buckets, but if I try grunt s3task:dev it pushes all of them.

alana314 commented 9 years ago

nm I figured it out, I had to run grunt s3:dev and grunt s3:prod