Fallback to default S3 URL on empty media upload URL in settings.
This commit is contained in:
parent
d91d6e5ce3
commit
b46ab6d3a9
2 changed files with 3 additions and 4 deletions
|
@ -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>
|
||||
|
|
|
@ -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, "/")
|
||||
|
||||
|
|
Loading…
Reference in a new issue