working commit

This commit is contained in:
2026-02-21 13:16:30 +02:00
parent cd37a4508c
commit d650d58a6d
1149 changed files with 116 additions and 722633 deletions
+9 -15
View File
@@ -17,7 +17,7 @@ import (
"mstore/app/router"
"mstore/pkg/auxhttp"
"mstore/pkg/auxpwd"
"mstore/pkg/term"
"mstore/pkg/terms"
)
const (
@@ -50,7 +50,7 @@ func (hand *Handler) CheckAccess(rctx *router.Context) (bool, string, error) {
var password string
var accountID string
accountID = term.AnonymousID
accountID = terms.AnonymousID
authHeader := rctx.GetHeader("Authorization")
if authHeader != "" {
@@ -75,7 +75,7 @@ func (hand *Handler) CheckAccess(rctx *router.Context) (bool, string, error) {
}
anonymous:
success = true
accountID = term.AnonymousID
accountID = terms.AnonymousID
return success, accountID, err
}
@@ -104,14 +104,7 @@ func (hand *Handler) ValidatePassword(ctx context.Context, username, password st
func (hand *Handler) CheckRight(ctx context.Context, accountID, reqRight, subject string) (bool, error) {
var err error
var res bool
//hand.logg.Debugf("Cop check your right %s: %s %s", accountID, reqRight, subject)
// =[]=
// .------. ---
// .---[-] [#] \--, ---
// >| [ ] [ ] | ---...
// '--0-------0----'
// Bad news for you, baby.... #
//
hand.logg.Debugf("Check right %s: right=%s subj=%s", accountID, reqRight, subject)
exists, grants, err := hand.mdb.ListGrantsByAccoundIDRight(ctx, accountID, reqRight)
if err != nil {
return res, err
@@ -120,11 +113,13 @@ func (hand *Handler) CheckRight(ctx context.Context, accountID, reqRight, subjec
return res, err
}
switch reqRight {
case term.RightReadFiles, term.RightWriteFiles:
case terms.RightReadFiles, terms.RightWriteFiles, terms.RightReadImages, terms.RightWriteImages:
for _, grant := range grants {
hand.logg.Debugf("Grant pattern=[%s], subject=[%s]", grant.Pattern, subject)
re, err := regexp.Compile(grant.Pattern)
if err != nil {
hand.logg.Warningf("Wrong pattern %s for grant %s: %v", grant.Pattern, grant.ID, err)
hand.logg.Warningf("Wrong regexp %s for grant %s: %v", grant.Pattern, grant.ID, err)
err = nil
continue
}
@@ -134,8 +129,7 @@ func (hand *Handler) CheckRight(ctx context.Context, accountID, reqRight, subjec
}
}
default:
// NOP
res = true
}
res = true
return res, err
}
+6 -6
View File
@@ -14,7 +14,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/term"
"mstore/pkg/terms"
)
// POST /v3/account/create 200 200
@@ -29,7 +29,7 @@ func (hand *Handler) CreateAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -62,7 +62,7 @@ func (hand *Handler) GetAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -95,7 +95,7 @@ func (hand *Handler) ListAccounts(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -128,7 +128,7 @@ func (hand *Handler) UpdateAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -161,7 +161,7 @@ func (hand *Handler) DeleteAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, params.Username)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, params.Username)
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
+7 -7
View File
@@ -16,7 +16,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/term"
"mstore/pkg/terms"
)
// HEAD /v2/<name>/blobs/<digest> 200 404
@@ -32,7 +32,7 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -72,7 +72,7 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -117,7 +117,7 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -161,7 +161,7 @@ func (hand *Handler) PutUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -191,7 +191,7 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -237,7 +237,7 @@ func (hand *Handler) DeleteBlob(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
+8 -8
View File
@@ -15,7 +15,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/term"
"mstore/pkg/terms"
)
const zeroContentLength = "0"
@@ -28,7 +28,7 @@ func (hand *Handler) FileInfo(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadFiles, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, params.Filepath)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -73,7 +73,7 @@ func (hand *Handler) PutFile(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteFiles, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteFiles, params.Filepath)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -101,7 +101,7 @@ func (hand *Handler) GetFile(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadFiles, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, params.Filepath)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -149,7 +149,7 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteFiles, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteFiles, params.Filepath)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -186,7 +186,7 @@ func (hand *Handler) ListFiles(rctx *router.Context) {
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadFiles, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, params.Filepath)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -223,7 +223,7 @@ func (hand *Handler) ListCollections(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadFiles, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, params.Path)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -261,7 +261,7 @@ func (hand *Handler) DeleteCollection(rctx *router.Context) {
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadFiles, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, params.Path)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
+6 -6
View File
@@ -14,7 +14,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/term"
"mstore/pkg/terms"
)
// POST /v3/grant/create 200 200
@@ -29,7 +29,7 @@ func (hand *Handler) CreateGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -62,7 +62,7 @@ func (hand *Handler) GetGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -95,7 +95,7 @@ func (hand *Handler) ListGrants(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -128,7 +128,7 @@ func (hand *Handler) UpdateGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -161,7 +161,7 @@ func (hand *Handler) DeleteGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
+8 -8
View File
@@ -14,14 +14,14 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/term"
"mstore/pkg/terms"
)
func (hand *Handler) ManifestExists(rctx *router.Context) {
name, _ := rctx.GetSubpath("name")
reference, _ := rctx.GetSubpath("reference")
hand.DumpHeaders("ManigestExists:\n", rctx)
//hand.DumpHeaders("ManigestExists:\n", rctx)
params := &operator.ManifestExistsParams{
Name: name,
@@ -29,7 +29,7 @@ func (hand *Handler) ManifestExists(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -71,7 +71,7 @@ func (hand *Handler) PutManifest(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -104,7 +104,7 @@ func (hand *Handler) GetManifest(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -144,7 +144,7 @@ func (hand *Handler) DeleteManifest(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -173,7 +173,7 @@ func (hand *Handler) GetReferer(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -199,7 +199,7 @@ func (hand *Handler) GetTags(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, params.Name)
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
+38 -101
View File
@@ -17,7 +17,7 @@ import (
"mstore/pkg/auxtool"
"mstore/pkg/auxuuid"
"mstore/pkg/descr"
"mstore/pkg/term"
"mstore/pkg/terms"
)
func (db *Database) WriteAnonymous(ctx context.Context) error {
@@ -27,14 +27,14 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
password := auxtool.RandomString(64)
passhash := auxpwd.MakeSHA256Hash([]byte(password))
accountDescr := &descr.Account{
ID: term.AnonymousID,
Username: term.AnonimousUsername,
ID: terms.AnonymousID,
Username: terms.AnonimousUsername,
Passhash: passhash,
Disabled: false,
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
}
err = db.InsertAccount(ctx, accountDescr)
if err != nil {
@@ -43,12 +43,12 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
grantDescr := &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightReadFiles,
Right: terms.RightReadFiles,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -57,12 +57,12 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightReadImages,
Right: terms.RightReadImages,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -76,107 +76,44 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
func (db *Database) WriteInituser(ctx context.Context) error {
var err error
now := auxtool.TimeNow()
passhash := auxpwd.MakeSHA256Hash([]byte(term.InitUsername))
passhash := auxpwd.MakeSHA256Hash([]byte(terms.InitUsername))
accountDescr := &descr.Account{
ID: term.InitID,
Username: term.InitUsername,
ID: terms.InitID,
Username: terms.InitUsername,
Passhash: passhash,
Disabled: false,
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
}
err = db.InsertAccount(ctx, accountDescr)
if err != nil {
return err
}
// Files
grantDescr := &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightReadFiles,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
fullRights := []string{
terms.RightWriteAccounts,
terms.RightReadAccounts,
terms.RightWriteFiles,
terms.RightReadFiles,
terms.RightWriteImages,
terms.RightReadImages,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightWriteFiles,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
// Accounts
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightReadAccounts,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightWriteAccounts,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
// Images
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightReadImages,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: term.RightWriteImages,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
for _, right := range fullRights {
grantDescr := &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: right,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
}
return err
+7 -7
View File
@@ -24,7 +24,7 @@ import (
"mstore/pkg/auxtool"
"mstore/pkg/auxuuid"
"mstore/pkg/descr"
"mstore/pkg/term"
"mstore/pkg/terms"
)
// FileInfo
@@ -300,14 +300,14 @@ func (oper *Operator) ListFiles(ctx context.Context, operatorID string, params *
Files: make([]descr.File, 0),
}
switch params.PathAs {
case term.AsRegexp:
case terms.AsRegexp:
files, err := oper.listFilesWithRegex(ctx, params.Filepath)
if err != nil {
code := http.StatusInternalServerError
return code, res, err
}
res.Files = files
case term.AsPrefix:
case terms.AsPrefix:
params.Filepath, err = cleanFilepath(params.Filepath)
if err != nil {
code := http.StatusInternalServerError
@@ -414,13 +414,13 @@ func (oper *Operator) ListCollections(ctx context.Context, operatorID string, pa
collectionList := make([]string, 0)
switch param.PathAS {
case term.AsRegexp:
case terms.AsRegexp:
collectionList, err = oper.listCollectionsWithRegexp(ctx, param.Path)
if err != nil {
code := http.StatusInternalServerError
return code, res, err
}
case term.AsPrefix:
case terms.AsPrefix:
param.Path, err = cleanFilepath(param.Path)
if err != nil {
code := http.StatusInternalServerError
@@ -545,7 +545,7 @@ func (oper *Operator) DeleteColletion(ctx context.Context, operatorID string, pa
Files: make([]descr.File, 0),
}
switch param.PathAs {
case term.AsRegexp:
case terms.AsRegexp:
collections, err := oper.listCollectionsWithRegexp(ctx, param.Path)
if err != nil {
code := http.StatusInternalServerError
@@ -562,7 +562,7 @@ func (oper *Operator) DeleteColletion(ctx context.Context, operatorID string, pa
}
res.Files = allfiles
case term.AsPrefix:
case terms.AsPrefix:
param.Path, err = cleanFilepath(param.Path)
if err != nil {
code := http.StatusInternalServerError