Skip to content

Commit 5de2de1

Browse files
committed
Fix: lambda korean and ext lowerCase
1 parent 8033828 commit 5de2de1

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

ch7/lambda/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ exports.handler = async (event, context, callback) => {
77
const Bucket = event.Records[0].s3.bucket.name; // react-nodebird-s3
88
const Key = event.Records[0].s3.object.key; // original/12312312_abc.png
99
console.log(Bucket, Key);
10-
const filename = Key.split('/')[Key.split('/').length - 1];
11-
const ext = Key.split('.')[Key.split('.').length - 1];
10+
const filename = decodeURIComponent(Key.split('/')[Key.split('/').length - 1]);
11+
const ext = Key.split('.')[Key.split('.').length - 1].toLowerCase();
1212
const requiredFormat = ext === 'jpg' ? 'jpeg' : ext;
1313
console.log('filename', filename, 'ext', ext);
1414

https/lambda/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ exports.handler = async (event, context, callback) => {
77
const Bucket = event.Records[0].s3.bucket.name; // react-nodebird-s3
88
const Key = event.Records[0].s3.object.key; // original/12312312_abc.png
99
console.log(Bucket, Key);
10-
const filename = Key.split('/')[Key.split('/').length - 1];
11-
const ext = Key.split('.')[Key.split('.').length - 1];
10+
const filename = decodeURIComponent(Key.split('/')[Key.split('/').length - 1]);
11+
const ext = Key.split('.')[Key.split('.').length - 1].toLowerCase();
1212
const requiredFormat = ext === 'jpg' ? 'jpeg' : ext;
1313
console.log('filename', filename, 'ext', ext);
1414

0 commit comments

Comments
 (0)