Compare commits

..

No commits in common. "80d7288ea45ea69060eb41709f188c09b33ca266" and "2bdc38e5921c28994437830561072257c3dca45e" have entirely different histories.

5 changed files with 8 additions and 33 deletions

View File

@ -4,7 +4,6 @@
package setting
import (
"bytes"
"os"
"regexp"
"strconv"
@ -132,11 +131,6 @@ func EnvironmentToConfig(cfg ConfigProvider, envs []string) (changed bool) {
log.Error("Error reading file for %s : %v", envKey, envValue, err)
continue
}
if bytes.HasSuffix(fileContent, []byte("\r\n")) {
fileContent = fileContent[:len(fileContent)-2]
} else if bytes.HasSuffix(fileContent, []byte("\n")) {
fileContent = fileContent[:len(fileContent)-1]
}
keyValue = string(fileContent)
}

View File

@ -99,19 +99,4 @@ key = old
changed = EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
assert.True(t, changed)
assert.Equal(t, "value-from-file", cfg.Section("sec").Key("key").String())
cfg, _ = NewConfigProviderFromData("")
_ = os.WriteFile(tmpFile, []byte("value-from-file\n"), 0o644)
EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
assert.Equal(t, "value-from-file", cfg.Section("sec").Key("key").String())
cfg, _ = NewConfigProviderFromData("")
_ = os.WriteFile(tmpFile, []byte("value-from-file\r\n"), 0o644)
EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
assert.Equal(t, "value-from-file", cfg.Section("sec").Key("key").String())
cfg, _ = NewConfigProviderFromData("")
_ = os.WriteFile(tmpFile, []byte("value-from-file\n\n"), 0o644)
EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
assert.Equal(t, "value-from-file\n", cfg.Section("sec").Key("key").String())
}

View File

@ -90,16 +90,12 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
return nil, convertMinioErr(err)
}
// Check to see if we already own this bucket
exists, errBucketExists := minioClient.BucketExists(ctx, config.Bucket)
if errBucketExists != nil {
return nil, convertMinioErr(err)
}
if !exists {
if err := minioClient.MakeBucket(ctx, config.Bucket, minio.MakeBucketOptions{
Region: config.Location,
}); err != nil {
if err := minioClient.MakeBucket(ctx, config.Bucket, minio.MakeBucketOptions{
Region: config.Location,
}); err != nil {
// Check to see if we already own this bucket (which happens if you run this twice)
exists, errBucketExists := minioClient.BucketExists(ctx, config.Bucket)
if !exists || errBucketExists != nil {
return nil, convertMinioErr(err)
}
}

View File

@ -31,7 +31,7 @@ function makeCollections({mentions, emoji}) {
if (mentions) {
collections.push({
values: window.config.tributeValues ?? [],
values: window.config.tributeValues,
requireLeadingSpace: true,
menuItemTemplate: (item) => {
return `

View File

@ -32,7 +32,7 @@ export function matchMention(queryText) {
// results is a map of weights, lower is better
const results = new Map();
for (const obj of window.config.tributeValues ?? []) {
for (const obj of window.config.tributeValues) {
const index = obj.key.toLowerCase().indexOf(query);
if (index === -1) continue;
const existing = results.get(obj);