Nested folders: Do not expose the sequential ID from the folder store (#60702)

* Nested folders: Do not expose the sequential ID from the folder store
This commit is contained in:
Sofia Papagiannaki
2023-01-06 16:04:17 +02:00
committed by GitHub
parent 9c0d830e26
commit e2ed42c2a3
2 changed files with 86 additions and 52 deletions
+2 -2
View File
@@ -163,12 +163,12 @@ func (ss *sqlStore) Get(ctx context.Context, q folder.GetFolderQuery) (*folder.F
exists := false
var err error
switch {
case q.UID != nil:
exists, err = sess.SQL("SELECT * FROM folder WHERE uid = ? AND org_id = ?", q.UID, q.OrgID).Get(foldr)
case q.ID != nil:
exists, err = sess.SQL("SELECT * FROM folder WHERE id = ?", q.ID).Get(foldr)
case q.Title != nil:
exists, err = sess.SQL("SELECT * FROM folder WHERE title = ? AND org_id = ?", q.Title, q.OrgID).Get(foldr)
case q.UID != nil:
exists, err = sess.SQL("SELECT * FROM folder WHERE uid = ? AND org_id = ?", q.UID, q.OrgID).Get(foldr)
default:
return folder.ErrBadRequest.Errorf("one of ID, UID, or Title must be included in the command")
}