Skip to content

Commit

Permalink
Fallback to default S3 URL on empty media upload URL in settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Oct 4, 2021
1 parent d91d6e5 commit b46ab6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions frontend/src/views/settings/media.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@
label-position="on-border"
:message="$t('settings.media.s3.urlHelp')" expanded>
<b-input v-model="data['upload.s3.url']"
name="upload.s3.url"
:disabled="!data['upload.s3.bucket']"
name="upload.s3.url" :disabled="!data['upload.s3.bucket']" required
placeholder="https://s3.region.amazonaws.com" :maxlength="200" />
</b-field>
</div>
Expand Down
4 changes: 2 additions & 2 deletions internal/media/providers/s3/s3.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package s3

import (
"errors"
"fmt"
"io"
"strings"
"time"
Expand Down Expand Up @@ -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, "/")

Expand Down

0 comments on commit b46ab6d

Please sign in to comment.