From 64b93b59536b210053c5527659ae2889b81ceb39 Mon Sep 17 00:00:00 2001 From: Joey Eamigh <55670930+JoeyEamigh@users.noreply.github.com> Date: Fri, 3 Dec 2021 03:44:57 -0500 Subject: [PATCH] adding proper support for the spaces_url param (#876) --- packages/medusa-file-spaces/src/services/digital-ocean.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 }) }) })