mirror of
https://github.com/multipleof4/ntfy.git
synced 2026-10-08 21:05:21 +00:00
Move stuff around
This commit is contained in:
@@ -3,7 +3,6 @@ package attachment
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"heckel.io/ntfy/v2/log"
|
||||
@@ -38,15 +37,10 @@ func (b *s3Backend) List() ([]object, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
prefix := b.client.Prefix
|
||||
result := make([]object, 0, len(objects))
|
||||
for _, obj := range objects {
|
||||
id := obj.Key
|
||||
if prefix != "" {
|
||||
id = strings.TrimPrefix(id, prefix+"/")
|
||||
}
|
||||
result = append(result, object{
|
||||
ID: id,
|
||||
ID: obj.Key,
|
||||
Size: obj.Size,
|
||||
LastModified: obj.LastModified,
|
||||
})
|
||||
|
||||
@@ -197,7 +197,7 @@ func TestS3Store_Sync_SkipsRecentFiles(t *testing.T) {
|
||||
func newTestS3Store(t *testing.T, server *httptest.Server, bucket, prefix string, totalSizeLimit int64) *Store {
|
||||
t.Helper()
|
||||
host := strings.TrimPrefix(server.URL, "https://")
|
||||
backend := newS3Backend(&s3.Client{
|
||||
backend := newS3Backend(s3.New(&s3.Config{
|
||||
AccessKey: "AKID",
|
||||
SecretKey: "SECRET",
|
||||
Region: "us-east-1",
|
||||
@@ -206,7 +206,7 @@ func newTestS3Store(t *testing.T, server *httptest.Server, bucket, prefix string
|
||||
Prefix: prefix,
|
||||
PathStyle: true,
|
||||
HTTPClient: server.Client(),
|
||||
})
|
||||
}))
|
||||
cache, err := newStore(backend, totalSizeLimit, nil)
|
||||
require.Nil(t, err)
|
||||
t.Cleanup(func() { cache.Close() })
|
||||
|
||||
Reference in New Issue
Block a user