diff --git a/packages/medusa-file-spaces/src/services/digital-ocean.js b/packages/medusa-file-spaces/src/services/digital-ocean.js index a03e67fcce..82e6a66e77 100644 --- a/packages/medusa-file-spaces/src/services/digital-ocean.js +++ b/packages/medusa-file-spaces/src/services/digital-ocean.js @@ -7,7 +7,7 @@ class DigitalOceanService extends FileService { super() this.bucket_ = options.bucket - this.spacesUrl_ = options.spaces_url + this.spacesUrl_ = options.spaces_url?.replace(/\/$/, "") this.accessKeyId_ = options.access_key_id this.secretAccessKey_ = options.secret_access_key this.region_ = options.region @@ -38,6 +38,10 @@ class DigitalOceanService extends FileService { return } + if (this.spacesUrl_) { + resolve({ url: `${this.spacesUrl_}/${data.Key}` }) + } + resolve({ url: data.Location }) }) })