Skip to content

Commit 227c7cf

Browse files
committed
Revise config check and don't throw error response to prevent leaking sensitive info
1 parent 3ba5566 commit 227c7cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ class S3Adapter {
146146
if (this._generateKey instanceof Function) {
147147
try {
148148
key_without_prefix = this._generateKey(filename, contentType, options);
149-
}catch(e){
150-
throw new Error(e); // throw error if generateKey function fails
149+
} catch {
150+
throw new Error('Key generation failed');
151151
}
152152
}
153153

@@ -189,7 +189,7 @@ class S3Adapter {
189189
const location = `${endpoint}/${params.Key}`;
190190

191191
let url;
192-
if (Object.keys(config).length != 0) { // if config is passed, we can generate a presigned url here
192+
if (config && typeof config === 'object' && Object.keys(config).length > 0) { // if config is passed, we can generate a presigned url here
193193
url = await this.getFileLocation(config, key_without_prefix);
194194
}
195195

0 commit comments

Comments
 (0)