diff --git a/index.js b/index.js index d2b537f..216cf71 100644 --- a/index.js +++ b/index.js @@ -21,7 +21,19 @@ module.exports = function (aws, options) { // Verify this is a file if (!file.isBuffer()) { return file; } - var uploadPath = file.path.replace(file.base, options.uploadPath || ''); + var uploadPath; + + if (options.uploadPathResolution) { + if (regexGzip.test(file.path)) { + uploadPath = options.uploadPathResolution(file.path.substring(0, file.path.length - 3)); + } else { + uploadPath = options.uploadPathResolution(file.path); + } + } else { + uploadPath = options.uploadPath || ''; + } + + uploadPath = file.path.replace(file.base, uploadPath); uploadPath = uploadPath.replace(new RegExp('\\\\', 'g'), '/'); var headers = { 'x-amz-acl': 'public-read' }; if (options.headers) {