From 1ab6393c4e66d23bfae571d893b3edd86473d385 Mon Sep 17 00:00:00 2001 From: Alex Gustafsson Date: Sun, 22 Dec 2024 21:10:04 +0100 Subject: [PATCH] Remove undocumented sort type --- internal/store/store.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/internal/store/store.go b/internal/store/store.go index 034baef..e8516cc 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -671,9 +671,8 @@ const ( type Sort string const ( - SortReference Sort = "reference" - SortLastModified Sort = "last_modified" - SortBump Sort = "bump" + SortReference Sort = "reference" + SortBump Sort = "bump" ) type ListImageOptions struct { @@ -702,10 +701,9 @@ func (s *Store) ListImages(ctx context.Context, options *ListImageOptions) (*mod // NOTE: This mapping is done to hard code strings used in SQL queries to // prevent injection attacks sort, ok := map[Sort]string{ - "": "bump", - SortReference: "reference", - SortLastModified: "last_modified", - SortBump: "bump", + "": "bump", + SortReference: "reference", + SortBump: "bump", }[options.Sort] if !ok { return nil, fmt.Errorf("invalid sort") @@ -814,8 +812,6 @@ func (s *Store) ListImages(ctx context.Context, options *ListImageOptions) (*mod switch sort { case "reference": orderClause = "ORDER BY images.reference " + order - case "last_modified": - orderClause = "ORDER BY images.last_modified " + order case "bump": orderClause = "ORDER BY images.versionDiffSortable " + order + ", images.reference" }