Skip to content

Commit 35edde4

Browse files
committed
Extract constant.
1 parent 704dd60 commit 35edde4

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

s3/src/main/java/ch/cyberduck/core/s3/S3BucketCreateService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void create(final Path bucket, final String region) throws BackgroundExce
7171
}
7272
// Create bucket
7373
session.getClient().createBucket(URIEncoder.encode(containerService.getContainer(bucket).getName()),
74-
"us-east-1".equals(region) ? "US" : region, acl);
74+
S3LocationFeature.DEFAULT_REGION.getIdentifier().equals(region) ? "US" : region, acl);
7575
}
7676
catch(ServiceException e) {
7777
throw new S3ExceptionMappingService().map("Cannot create folder {0}", e, bucket);

s3/src/main/java/ch/cyberduck/core/s3/S3LocationFeature.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public class S3LocationFeature implements Location {
4242
private final PathContainerService containerService;
4343
private final RegionEndpointCache cache;
4444

45+
public static final S3Region DEFAULT_REGION = new S3Region("us-east-1");
46+
4547
public S3LocationFeature(final S3Session session) {
4648
this(session, new RegionEndpointCache());
4749
}
@@ -111,12 +113,12 @@ protected Name getLocation(final String bucketname) throws BackgroundException {
111113
final S3Region region;
112114
if(StringUtils.isBlank(location)) {
113115
log.warn(String.format("No region known for bucket %s", bucketname));
114-
region = new S3Region("us-east-1");
116+
region = DEFAULT_REGION;
115117
}
116118
else {
117119
switch(location) {
118120
case "US":
119-
region = new S3Region("us-east-1");
121+
region = DEFAULT_REGION;
120122
break;
121123
case "EU":
122124
region = new S3Region("eu-west-1");

s3/src/main/java/ch/cyberduck/core/s3/S3PresignedUrlProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public String create(final String secret, final String bucket, String region, fi
4949
switch(session.getSignatureVersion()) {
5050
case AWS4HMACSHA256:
5151
// Region is required for AWS4-HMAC-SHA256 signature
52-
region = "us-east-1";
52+
region = S3LocationFeature.DEFAULT_REGION.getIdentifier();
5353
}
5454
}
5555
final Host bookmark = session.getHost();

0 commit comments

Comments
 (0)