Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions api/src/main/java/io/minio/Http.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.common.collect.Multimap;
import io.minio.credentials.Credentials;
import io.minio.errors.MinioException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
Expand Down Expand Up @@ -450,15 +451,25 @@ private static X509TrustManager getTrustManagerFromDir(String dirPath)
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null);

List<Path> directories =
Stream.of(dirPath.split(File.pathSeparator))
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(Paths::get)
.filter(Files::isDirectory)
.collect(Collectors.toList());

int index = 0;
try (Stream<Path> paths = Files.walk(Paths.get(dirPath))) {
int number = 1;
for (Path file : (Iterable<Path>) paths.filter(Files::isRegularFile)::iterator) {
try {
index += setCertificateEntry(cf, ks, file, "cert-dir-file-" + number + "-");
number++;
} catch (CertificateException | IOException | KeyStoreException e) {
// Ignore these errors.
int number = 1;
for (Path directory : directories) {
try (Stream<Path> paths = Files.walk(directory)) {
for (Path file : (Iterable<Path>) paths.filter(Files::isRegularFile)::iterator) {
try {
index += setCertificateEntry(cf, ks, file, "cert-dir-file-" + number + "-");
number++;
} catch (CertificateException | IOException | KeyStoreException e) {
// Ignore these errors.
}
}
}
}
Expand Down
Loading