From 5e88e7b31f9be85ad4263a8d89d85b71ce526c51 Mon Sep 17 00:00:00 2001 From: Evgeny Kolyakov Date: Sat, 22 Jun 2019 14:14:10 +0300 Subject: [PATCH] Added Unicode Support I had named of files in Hebrew and I was getting: Error: Could not invalidate cloudfront: InvalidArgument: Your request contains one or more invalid invalidation paths. And with that fix, it works fine :) --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9640b5b..b2959c7 100644 --- a/index.js +++ b/index.js @@ -59,9 +59,10 @@ module.exports = function (options) { case 'update': case 'create': case 'delete': - let path = file.s3.path; + let path = file.s3.path.split('/').map(encodeURIComponent).join('/'); if (options.originPath) { + options.originPath = options.originPath.split('/').map(encodeURIComponent).join('/'); const originRegex = new RegExp(options.originPath.replace(/^\//, '') + '\/?'); path = path.replace(originRegex, ''); }