feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s
Build and publish container images / images (push) Failing after 12m29s
This commit is contained in:
1 parent
96065d1e89
commit
0ba1dcfef0
243 files changed
+21441
-3090
No files matched your search
@@ -5,6 +5,8 @@ import (
|
||||
"database/sql"
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
func DAVFilename(c Calendar, uid string) string {
|
||||
@@ -36,7 +38,7 @@ func DAVUID(c Calendar, name string) (string, error) {
|
||||
}
|
||||
}
|
||||
b, err := base64.RawURLEncoding.DecodeString(strings.TrimSuffix(name, ".ics"))
|
||||
if err != nil || len(b) == 0 || len(b) > 512 {
|
||||
if err != nil || len(b) == 0 || len(b) > 512 || !utf8.Valid(b) || strings.IndexFunc(string(b), unicode.IsControl) >= 0 {
|
||||
return "", ErrMissing
|
||||
}
|
||||
return string(b), nil
|
||||
@@ -44,7 +46,8 @@ func DAVUID(c Calendar, name string) (string, error) {
|
||||
|
||||
// DAVSnapshot is complete or fails; a truncated listing can cause client deletes.
|
||||
// The metadata lock keeps href mappings and event generations in one snapshot.
|
||||
func (r *Repository) DAVSnapshot(ctx context.Context, domain, id, actor string, withData bool) (Calendar, []Event, error) {
|
||||
func (r *Repository) DAVSnapshot(ctx context.Context, domain, id, actor string, withData bool) (result Calendar, itemsResult []Event, resultErr error) {
|
||||
defer func() { resultErr = r.failure(resultErr) }()
|
||||
c, _, unlock, err := r.locked(ctx, domain, id, actor)
|
||||
if err != nil {
|
||||
return c, nil, err
|
||||
@@ -54,7 +57,7 @@ func (r *Repository) DAVSnapshot(ctx context.Context, domain, id, actor string,
|
||||
if withData {
|
||||
cols = "uid,etag,data"
|
||||
}
|
||||
rows, err := r.DB.QueryContext(ctx, `SELECT `+cols+` FROM calendar_event_cache WHERE domain=? AND calendar=? ORDER BY uid LIMIT 10001`, domain, id)
|
||||
rows, err := r.DB.QueryContext(ctx, `SELECT `+cols+` FROM calendar_event_cache WHERE domain=`+r.p(1)+` AND calendar=`+r.p(2)+` ORDER BY uid LIMIT 10001`, domain, id)
|
||||
if err != nil {
|
||||
return c, nil, err
|
||||
}
|
||||
@@ -77,7 +80,8 @@ func (r *Repository) DAVSnapshot(ctx context.Context, domain, id, actor string,
|
||||
|
||||
// ChangeDAV reserves resource identities in the same manifest commit as the
|
||||
// monthly snapshots. Existing resources still require an exact strong ETag.
|
||||
func (r *Repository) ChangeDAV(ctx context.Context, domain, id, actor, name, match string, item *Event, authorize func() error) (Event, bool, error) {
|
||||
func (r *Repository) ChangeDAV(ctx context.Context, domain, id, actor, name, match string, item *Event, authorize func() error) (eventResult Event, created bool, resultErr error) {
|
||||
defer func() { resultErr = r.failure(resultErr) }()
|
||||
if !ValidDAVFilename(name) {
|
||||
return Event{}, false, ErrInvalid
|
||||
}
|
||||
@@ -94,7 +98,7 @@ func (r *Repository) ChangeDAV(ctx context.Context, domain, id, actor, name, mat
|
||||
uid, _ := DAVUID(c, name)
|
||||
var exists bool
|
||||
if uid != "" {
|
||||
if err = r.DB.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM calendar_event_cache WHERE domain=? AND calendar=? AND uid=?)`, domain, id, uid).Scan(&exists); err != nil {
|
||||
if err = r.DB.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM calendar_event_cache WHERE domain=`+r.p(1)+` AND calendar=`+r.p(2)+` AND uid=`+r.p(3)+`)`, domain, id, uid).Scan(&exists); err != nil {
|
||||
return Event{}, false, err
|
||||
}
|
||||
}
|
||||
@@ -114,7 +118,7 @@ func (r *Repository) ChangeDAV(ctx context.Context, domain, id, actor, name, mat
|
||||
}
|
||||
uid = item.UID
|
||||
var tag string
|
||||
err = r.DB.QueryRowContext(ctx, `SELECT etag FROM calendar_event_cache WHERE domain=? AND calendar=? AND uid=?`, domain, id, uid).Scan(&tag)
|
||||
err = r.DB.QueryRowContext(ctx, `SELECT etag FROM calendar_event_cache WHERE domain=`+r.p(1)+` AND calendar=`+r.p(2)+` AND uid=`+r.p(3), domain, id, uid).Scan(&tag)
|
||||
if err == nil {
|
||||
return Event{}, false, ErrConflict
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user