diff --git a/README.md b/README.md index 1624a7371..512288f07 100644 --- a/README.md +++ b/README.md @@ -12,19 +12,19 @@ Java 1.8 or above. io.minio minio - 8.5.11 + 8.5.12 ``` ## Gradle usage ``` dependencies { - implementation("io.minio:minio:8.5.11") + implementation("io.minio:minio:8.5.12") } ``` ## JAR download -The latest JAR can be downloaded from [here](https://repo1.maven.org/maven2/io/minio/minio/8.5.11/) +The latest JAR can be downloaded from [here](https://repo1.maven.org/maven2/io/minio/minio/8.5.12/) ## Quick Start Example - File Uploader This example program connects to an object storage server, makes a bucket on the server and then uploads a file to the bucket. @@ -92,12 +92,12 @@ public class FileUploader { #### Compile FileUploader ```sh -$ javac -cp minio-8.5.11-all.jar FileUploader.java +$ javac -cp minio-8.5.12-all.jar FileUploader.java ``` #### Run FileUploader ```sh -$ java -cp minio-8.5.11-all.jar:. FileUploader +$ java -cp minio-8.5.12-all.jar:. FileUploader '/home/user/Photos/asiaphotos.zip' is successfully uploaded as object 'asiaphotos-2015.zip' to bucket 'asiatrip'. $ mc ls play/asiatrip/ diff --git a/api/src/main/java/io/minio/BucketArgs.java b/api/src/main/java/io/minio/BucketArgs.java index a7877eb10..c50bcdfda 100644 --- a/api/src/main/java/io/minio/BucketArgs.java +++ b/api/src/main/java/io/minio/BucketArgs.java @@ -39,9 +39,13 @@ public abstract static class Builder, A extends BucketAr extends BaseArgs.Builder { private static final Pattern BUCKET_NAME_REGEX = Pattern.compile("^[a-z0-9][a-z0-9\\.\\-]{1,61}[a-z0-9]$"); + protected boolean skipValidation = false; protected void validateBucketName(String name) { validateNotNull(name, "bucket name"); + if (skipValidation) { + return; + } if (!BUCKET_NAME_REGEX.matcher(name).find()) { throw new IllegalArgumentException( @@ -63,7 +67,7 @@ protected void validateBucketName(String name) { } private void validateRegion(String region) { - if (region != null && !HttpUtils.REGION_REGEX.matcher(region).find()) { + if (!skipValidation && region != null && !HttpUtils.REGION_REGEX.matcher(region).find()) { throw new IllegalArgumentException("invalid region " + region); } } @@ -80,6 +84,12 @@ public B bucket(String name) { return (B) this; } + @SuppressWarnings("unchecked") // Its safe to type cast to B as B extends this class. + public B skipValidation(boolean skipValidation) { + this.skipValidation = skipValidation; + return (B) this; + } + @SuppressWarnings("unchecked") // Its safe to type cast to B as B extends this class. public B region(String region) { validateRegion(region); diff --git a/api/src/main/java/io/minio/ObjectArgs.java b/api/src/main/java/io/minio/ObjectArgs.java index 60758c7ed..1d7759338 100644 --- a/api/src/main/java/io/minio/ObjectArgs.java +++ b/api/src/main/java/io/minio/ObjectArgs.java @@ -43,6 +43,9 @@ public abstract static class Builder, A extends ObjectAr extends BucketArgs.Builder { protected void validateObjectName(String name) { validateNotEmptyString(name, "object name"); + if (skipValidation) { + return; + } for (String token : name.split("/")) { if (token.equals(".") || token.equals("..")) { throw new IllegalArgumentException( diff --git a/api/src/main/java/io/minio/Signer.java b/api/src/main/java/io/minio/Signer.java index 4752a76d6..c45f11f1a 100644 --- a/api/src/main/java/io/minio/Signer.java +++ b/api/src/main/java/io/minio/Signer.java @@ -134,12 +134,14 @@ private void setCanonicalHeaders(Set ignored_headers) { // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html // * Header having multiple values should be converted to comma separated values. // * Multi-spaced value of header should be trimmed to single spaced value. + // * Trim leading/trailing spaces in header value (As OkHttp trims leading/trailing spaces + // automatically, this is added for completion). this.canonicalHeaders.put( signedHeader, headers.values(name).stream() .map( value -> { - return value.replaceAll("( +)", " "); + return value.replaceAll("( +)", " ").trim(); }) .collect(Collectors.joining(","))); } diff --git a/build.gradle b/build.gradle index 2fcb7c066..7fdf71b21 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ apply plugin: "de.marcphilipp.nexus-publish" allprojects { group = 'io.minio' - version = '8.5.12' + version = '8.5.13' if (!project.hasProperty('release')) { version += '-DEV' }