Skip to content

Commit

Permalink
improve argument handling
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Oct 4, 2023
1 parent e3fed8c commit 01abe67
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ public Object invoke(PageContext pc, Object[] args) throws PageException {

// required
String bucketName = cast.toString(args[0]);
String objectName = cast.toString(args[1]);
if (isEmpty(objectName)) objectName = null;

// optional
String objectName = args.length > 1 && !isEmpty(args[1]) ? cast.toString(args[1]) : null;
String accessKeyId = args.length > 2 && args[2] != null ? cast.toString(args[2]) : null;
String secretAccessKey = args.length > 3 && args[3] != null ? cast.toString(args[3]) : null;
String host = args.length > 4 && args[4] != null ? cast.toString(args[4]) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ public Object invoke(PageContext pc, Object[] args) throws PageException {

// required
String bucketName = cast.toString(args[0]);
String objectName = cast.toString(args[1]);
if (isEmpty(objectName)) objectName = null;

// optional
String objectName = args.length > 1 && !isEmpty(args[1]) ? cast.toString(args[1]) : null;
String accessKeyId = args.length > 2 && args[2] != null ? cast.toString(args[2]) : null;
String secretAccessKey = args.length > 3 && args[3] != null ? cast.toString(args[3]) : null;
String host = args.length > 4 && args[4] != null ? cast.toString(args[4]) : null;
Expand Down
4 changes: 2 additions & 2 deletions tests/functions/ACL.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {

// check inital data
if(useS3Function) {
var acl=isEmpty(arguments.objectName)?S3GetACL(arguments.bucketName):S3GetACL(arguments.bucketName,arguments.objectName);
var acl=S3GetACL(arguments.bucketName,isEmpty(arguments.objectName)?"":arguments.objectName);
}
else {
var acl=StoreGetACL(dir);
Expand All @@ -190,7 +190,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
}

if(useS3Function) {
var acl=isEmpty(arguments.objectName)?S3GetACL(arguments.bucketName):S3GetACL(arguments.bucketName,arguments.objectName);
var acl=S3GetACL(arguments.bucketName,isEmpty(arguments.objectName)?"":arguments.objectName);
}
else {
var acl=StoreGetACL(dir);
Expand Down

0 comments on commit 01abe67

Please sign in to comment.