Skip to content

Commit

Permalink
Merge branch 'master' into add-executor-service-to-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
delta11 authored Aug 20, 2024
2 parents a491d99 + ef85db9 commit 5e2cfa9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ Java 1.8 or above.
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.5.11</version>
<version>8.5.12</version>
</dependency>
```

## 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.
Expand Down Expand Up @@ -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/
Expand Down
12 changes: 11 additions & 1 deletion api/src/main/java/io/minio/BucketArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ public abstract static class Builder<B extends Builder<B, A>, A extends BucketAr
extends BaseArgs.Builder<B, A> {
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(
Expand All @@ -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);
}
}
Expand All @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions api/src/main/java/io/minio/ObjectArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public abstract static class Builder<B extends Builder<B, A>, A extends ObjectAr
extends BucketArgs.Builder<B, A> {
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(
Expand Down
4 changes: 3 additions & 1 deletion api/src/main/java/io/minio/Signer.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ private void setCanonicalHeaders(Set<String> 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(",")));
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down

0 comments on commit 5e2cfa9

Please sign in to comment.