From 3c5c420efecd55f0ac53c777cdb7f36d57b68dcd Mon Sep 17 00:00:00 2001 From: Miguel Branco Date: Fri, 9 Aug 2024 09:41:19 +0200 Subject: [PATCH] If any S3 cred is passed, use it instead. (#483) --- .../builtin/location_package/LocationFromS3Node.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/snapi-truffle/src/main/java/raw/runtime/truffle/ast/expressions/builtin/location_package/LocationFromS3Node.java b/snapi-truffle/src/main/java/raw/runtime/truffle/ast/expressions/builtin/location_package/LocationFromS3Node.java index ef34ea126..62aa6eae4 100644 --- a/snapi-truffle/src/main/java/raw/runtime/truffle/ast/expressions/builtin/location_package/LocationFromS3Node.java +++ b/snapi-truffle/src/main/java/raw/runtime/truffle/ast/expressions/builtin/location_package/LocationFromS3Node.java @@ -68,10 +68,13 @@ public Object executeGeneric(VirtualFrame frame) { // The docs say: // "If the S3 bucket is not registered in the credentials storage, then the region, accessKey // and secretKey must be provided as arguments." + // However, if the access key/secret key are passed, they should be used. RawContext context = RawContext.get(this); S3Path location; - - if (context.existsLocationConfig(bucket) && context.getLocationConfig(bucket).hasS3()) { + if (this.accessKey == null + && this.secretKey == null + && context.existsLocationConfig(bucket) + && context.getLocationConfig(bucket).hasS3()) { LocationConfig l = context.getLocationConfig(bucket); S3Config s3Config = l.getS3(); Option maybeAccessKey =