Skip to content

Commit f43c0fa

Browse files
committed
fixup
1 parent 51155d0 commit f43c0fa

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/routes/routeVeeam.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ function _getQueryValueCaseInsensitive(query, key) {
4444
return matchKey ? query[matchKey] : undefined;
4545
}
4646

47+
function _hasQueryKeyCaseInsensitive(query, key) {
48+
if (!query) {
49+
return false;
50+
}
51+
return Object.keys(query).some(k => k.toLowerCase() === key.toLowerCase());
52+
}
53+
4754
const routeMap = {
4855
GET: getVeeamFile,
4956
PUT: putVeeamFile,
@@ -84,8 +91,9 @@ function checkBucketAndKey(bucketName, objectKey, requestQueryParams, method, lo
8491
// Deletion requires that the tags of the object are returned.
8592
const queryKeys = Object.keys(requestQueryParams || {});
8693
const isPresignedGet = method === 'GET'
87-
&& (requestQueryParams && (_getQueryValueCaseInsensitive(requestQueryParams, 'X-Amz-Credential')
88-
|| _getQueryValueCaseInsensitive(requestQueryParams, 'tagging') !== undefined));
94+
&& (requestQueryParams
95+
&& (_hasQueryKeyCaseInsensitive(requestQueryParams, 'X-Amz-Credential')
96+
|| _hasQueryKeyCaseInsensitive(requestQueryParams, 'tagging')));
8997

9098
if (!isPresignedGet && queryKeys.length > 0) {
9199
const unsupportedKeys = queryKeys

0 commit comments

Comments
 (0)