Browse Source

Merge pull request #9765 from nocodb/nc-minio-handle-endpoint

fix: normalize endpoint url in Minio
pull/9771/head
Anbarasu 2 months ago committed by GitHub
parent
commit
93728095ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      packages/nocodb/src/plugins/mino/Minio.ts

23
packages/nocodb/src/plugins/mino/Minio.ts

@ -22,7 +22,28 @@ export default class Minio implements IStorageAdapterV2 {
private input: MinioObjectStorageInput;
constructor(input: unknown) {
this.input = input as MinioObjectStorageInput;
this.input = this.normalizeInput(input as MinioObjectStorageInput);
}
private normalizeInput(input: MinioObjectStorageInput) {
let endPoint = input.endPoint;
let useSSL = input.useSSL;
if (endPoint.startsWith('http://')) {
endPoint = endPoint.replace('http://', '');
useSSL = false;
} else if (endPoint.startsWith('https://')) {
useSSL = true;
endPoint = endPoint.replace('https://', '');
}
endPoint = endPoint.trim().replace(/\/+$/, '');
return {
...input,
endPoint,
useSSL,
};
}
public async init(): Promise<any> {

Loading…
Cancel
Save