mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-18 00:01:32 -04:00
Compare commits
No commits in common. "80d7288ea45ea69060eb41709f188c09b33ca266" and "2bdc38e5921c28994437830561072257c3dca45e" have entirely different histories.
80d7288ea4
...
2bdc38e592
@ -4,7 +4,6 @@
|
|||||||
package setting
|
package setting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -132,11 +131,6 @@ func EnvironmentToConfig(cfg ConfigProvider, envs []string) (changed bool) {
|
|||||||
log.Error("Error reading file for %s : %v", envKey, envValue, err)
|
log.Error("Error reading file for %s : %v", envKey, envValue, err)
|
||||||
continue
|
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)
|
keyValue = string(fileContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,19 +99,4 @@ key = old
|
|||||||
changed = EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
|
changed = EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
|
||||||
assert.True(t, changed)
|
assert.True(t, changed)
|
||||||
assert.Equal(t, "value-from-file", cfg.Section("sec").Key("key").String())
|
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())
|
|
||||||
}
|
}
|
||||||
|
@ -90,16 +90,12 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
|
|||||||
return nil, convertMinioErr(err)
|
return nil, convertMinioErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if we already own this bucket
|
if err := minioClient.MakeBucket(ctx, config.Bucket, minio.MakeBucketOptions{
|
||||||
exists, errBucketExists := minioClient.BucketExists(ctx, config.Bucket)
|
Region: config.Location,
|
||||||
if errBucketExists != nil {
|
}); err != nil {
|
||||||
return nil, convertMinioErr(err)
|
// 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 {
|
||||||
if !exists {
|
|
||||||
if err := minioClient.MakeBucket(ctx, config.Bucket, minio.MakeBucketOptions{
|
|
||||||
Region: config.Location,
|
|
||||||
}); err != nil {
|
|
||||||
return nil, convertMinioErr(err)
|
return nil, convertMinioErr(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ function makeCollections({mentions, emoji}) {
|
|||||||
|
|
||||||
if (mentions) {
|
if (mentions) {
|
||||||
collections.push({
|
collections.push({
|
||||||
values: window.config.tributeValues ?? [],
|
values: window.config.tributeValues,
|
||||||
requireLeadingSpace: true,
|
requireLeadingSpace: true,
|
||||||
menuItemTemplate: (item) => {
|
menuItemTemplate: (item) => {
|
||||||
return `
|
return `
|
||||||
|
@ -32,7 +32,7 @@ export function matchMention(queryText) {
|
|||||||
|
|
||||||
// results is a map of weights, lower is better
|
// results is a map of weights, lower is better
|
||||||
const results = new Map();
|
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);
|
const index = obj.key.toLowerCase().indexOf(query);
|
||||||
if (index === -1) continue;
|
if (index === -1) continue;
|
||||||
const existing = results.get(obj);
|
const existing = results.get(obj);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user