Skip to content

Commit

Permalink
correct which creds come first
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Oct 6, 2023
1 parent 342c5fc commit 5853a8a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ public static String loadWithNewPattern(S3Properties properties, RefString stora

));

if (!Util.isEmpty(accessKeyId)) properties.setAccessKeyId(accessKeyId);
if (!Util.isEmpty(secretAccessKey)) properties.setSecretAccessKey(secretAccessKey);
properties.setAccessKeyId(accessKeyId);
properties.setSecretAccessKey(secretAccessKey);
properties.setCustomCredentials(hasCustomCredentials);
properties.setCustomHost(hasCustomHost);
properties.setMapping(mapping);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ PropsAndEndpoint extractFromPath(CFMLEngine eng, String bucketName, String objec
if (objectName != null && objectName.endsWith("/")) objectName = objectName.substring(0, objectName.length() - 1);

// explicit credentals overrule in path credentials!
if (!Util.isEmpty(accessKeyId)) props.setAccessKeyId(accessKeyId);
if (!Util.isEmpty(secretAccessKey)) props.setSecretAccessKey(secretAccessKey);
if (!Util.isEmpty(host)) props.setHost(host);
if (!Util.isEmpty(accessKeyId)) {
props.setAccessKeyId(accessKeyId);
props.setSecretAccessKey(secretAccessKey);
props.setHost(host);
}
}
return new PropsAndEndpoint(props, bucketName, objectName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ public Object invoke(PageContext pc, Object[] args) throws PageException {
* secretAccessKey, host)); print.e("pae.bucketName:" + pae.bucketName); print.e("pae.objectName:" +
* pae.objectName);
*/

S3Properties props = pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host);
try {
// create S3 Instance
S3 s3 = S3.getInstance(props, toTimeout(timeout));
return s3.getMetaData(pae.bucketName, pae.objectName);
}
catch (Exception e) {
throw eng.getExceptionUtil().createApplicationException(eng.getStringUtil().replace(props.toString(), secretAccessKey, "...", false, true));
// throw eng.getCastUtil().toPageException(e);
throw eng.getCastUtil().toPageException(e);
}
}
}

0 comments on commit 5853a8a

Please sign in to comment.