AWS S3 Static WebSite Hosting - Failed to decode downloaded font

I'm hosting a SPA written in AngularJS on an AWS S3 bucket. The only thing that is not working are fonts, with these warnings showing up in Chrome's developer console:

Failed to decode downloaded font: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.woff
Failed to decode downloaded font: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.ttf?

The fonts are downloaded and even inspect-able on the network panel. The same happens for Bootstrap3 fonts - I was not able to get a single font working.

This happens on Firefox:

downloadable font: incorrect file size in WOFF header (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:1)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.woff
downloadable font: rejected by sanitizer (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:1)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.woff vendor.03dd8a42.css
downloadable font: incorrect entrySelector for table directory (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:2)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.ttf? vendor.03dd8a42.css
downloadable font: rejected by sanitizer (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:2)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.ttf?

I am using Grunt to build the app, and it has a step that does "string-replace".

Turns out it was parsing the binary font files and changing some bytes around causing the file to be corrupt.