From b46ab6d3a9e38f0b03b2ba0e2df8a258aa51fa30 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Mon, 4 Oct 2021 22:20:24 +0530 Subject: [PATCH] Fallback to default S3 URL on empty media upload URL in settings. --- frontend/src/views/settings/media.vue | 3 +-- internal/media/providers/s3/s3.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/settings/media.vue b/frontend/src/views/settings/media.vue index 2fdb256..018713d 100644 --- a/frontend/src/views/settings/media.vue +++ b/frontend/src/views/settings/media.vue @@ -95,8 +95,7 @@ label-position="on-border" :message="$t('settings.media.s3.urlHelp')" expanded> diff --git a/internal/media/providers/s3/s3.go b/internal/media/providers/s3/s3.go index fc38d48..12ee597 100644 --- a/internal/media/providers/s3/s3.go +++ b/internal/media/providers/s3/s3.go @@ -1,7 +1,7 @@ package s3 import ( - "errors" + "fmt" "io" "strings" "time" @@ -36,7 +36,7 @@ func NewS3Store(opt Opt) (media.Store, error) { err error ) if opt.URL == "" { - return nil, errors.New("Invalid AWS URL in settings.") + opt.URL = fmt.Sprintf("https://s3.%s.amazonaws.com", opt.Region) } opt.URL = strings.TrimRight(opt.URL, "/")