Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix minio path

Fendy Heryanto0dbd7c9125de
diff --git a/packages/nocodb/src/plugins/minio/Minio.ts b/packages/nocodb/src/plugins/minio/Minio.ts
index 0a288e1d29..945bfb3c36 100644
--- a/packages/nocodb/src/plugins/minio/Minio.ts
+++ b/packages/nocodb/src/plugins/minio/Minio.ts
@@ -299,17 +299,18 @@ export default class Minio implements IStorageAdapterV2 {
}
getUploadedPath(path: string): { path?: string; url?: string } {
+ const protocol = this.input.useSSL ? 'https' : 'http';
+ const defaultPort = this.input.useSSL ? 443 : 80;
+
+ const cleanPath = path.startsWith('/') ? path.slice(1) : path;
+
let url: string;
- // TODO: verify this
- if (this.input.useSSL && this.input.port === 443) {
- url = `https://${this.input.endPoint}/${path}`;
- } else if (!this.input.useSSL && this.input.port === 80) {
- url = `http://${this.input.endPoint}/${path}`;
+ if (this.input.port === defaultPort) {
+ url = `${protocol}://${this.input.endPoint}/${cleanPath}`;
} else {
- url = `http${this.input.useSSL ? 's' : ''}://${this.input.endPoint}:${
- this.input.port
- }/${path}`;
+ url = `${protocol}://${this.input.endPoint}:${this.input.port}/${cleanPath}`;
}
+
return { path, url };
}
}