From 5d2d609be4867bee67dbbcf9a66d0a9ccfb877e7 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 23 Feb 2023 13:56:58 +0100 Subject: [PATCH] sqlite: fix volume lookups with partial names Requires the trailing `%` to work correctly, see https://www.sqlitetutorial.net/sqlite-like/ Signed-off-by: Valentin Rothberg --- libpod/sqlite_state.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpod/sqlite_state.go b/libpod/sqlite_state.go index b3ef023a39..e03d7ad49b 100644 --- a/libpod/sqlite_state.go +++ b/libpod/sqlite_state.go @@ -2033,7 +2033,7 @@ func (s *SQLiteState) LookupVolume(name string) (*Volume, error) { return nil, define.ErrDBClosed } - rows, err := s.conn.Query("SELECT JSON FROM VolumeConfig WHERE Name LIKE ?;", name) + rows, err := s.conn.Query("SELECT JSON FROM VolumeConfig WHERE Name LIKE ?;", name+"%") if err != nil { return nil, fmt.Errorf("querying database for volume %s: %w", name, err) }