Skip to content

Commit

Permalink
better checking; update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
clineamb committed Sep 22, 2015
1 parent 89866ec commit 0a46368
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 1.3.1

* Fix Metadata/ContentEncoding overwrite.


## Version 1.3.0

* **NEW** -- Added `maps.ParamName` options! You can now map each parameter offered by the `S3.putObject` function. More in the [Readme](readme.md).
Expand Down
18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ gulpPrefixer = function (AWS) {
stream = es.map(function (file, callback) {

var keyTransform, keyname, keyparts, filename,
mimetype, mime_lookup_name, metadata, content_encoding,
mapped_params
mimetype, mime_lookup_name,
metadata = null, content_encoding = null
;

if(file.isNull()) {
Expand Down Expand Up @@ -100,8 +100,8 @@ gulpPrefixer = function (AWS) {

if (_.isFunction(options.metadataMap)) {
metadata = options.metadataMap(keyname);
} else {
metadata = options.metadataMap;
} else if(_.isObject(options.metadataMap)) {
options.Metadata = options.metadataMap;
}

// === manualContentEncoding ===========================
Expand All @@ -112,8 +112,8 @@ gulpPrefixer = function (AWS) {

if(_.isFunction(options.manualContentEncoding)) {
content_encoding = options.manualContentEncoding(keyname);
} else {
content_encoding = options.manualContentEncoding;
} else if(_.isString(options.manualContentEncoding)) {
options.ContentEncoding = options.manualContentEncoding;
}

// === maps.ParamNames =================================
Expand Down Expand Up @@ -183,11 +183,13 @@ gulpPrefixer = function (AWS) {
objOpts.Body = file.contents;
objOpts.ContentType = mimetype;

if(!_.isUndefined(metadata)) {
if(!_.isNull(metadata)) {
// existing objOpts.Metadata gets overwrriten
objOpts.Metadata = metadata;
}

if(!_.isUndefined(metadata)) {
if(!_.isNull(metadata)) {
// existing objOpts.ContentEncoding gets overwrriten
objOpts.ContentEncoding = content_encoding;
}

Expand Down

0 comments on commit 0a46368

Please sign in to comment.