fix create bucket
@@ -45,6 +45,7 @@ import org.lastaflute.web.servlet.request.stream.WrittenStreamOut;
import io.minio.MinioClient;
import io.minio.Result;
+import io.minio.errors.ErrorResponseException;
import io.minio.messages.Item;
/**
@@ -216,6 +217,19 @@ public class AdminStorageAction extends FessAdminAction {
break;
}
}
+ } catch (final ErrorResponseException e) {
+ final String code = e.errorResponse().code();
+ if ("NoSuchBucket".equals(code)) {
+ final MinioClient minioClient = createClient(fessConfig);
+ try {
+ minioClient.makeBucket(fessConfig.getStorageBucket());
+ logger.info("Created bucket: {}", fessConfig.getStorageBucket());
+ } catch (Exception e1) {
+ logger.warn("Failed to create bucket:" + fessConfig.getStorageBucket(), e1);
+ }
+ } else if (logger.isDebugEnabled()) {
+ logger.debug("Failed to access " + fessConfig.getStorageEndpoint(), e);
+ }
} catch (final Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to access " + fessConfig.getStorageEndpoint(), e);
