diff --git a/lib/passwordstate/resource_list.rb b/lib/passwordstate/resource_list.rb index beb262df39f50fc7ee77fec2060b94985393aff0..255b2a47904876e780c25e7f7962ffd7e9072df1 100644 --- a/lib/passwordstate/resource_list.rb +++ b/lib/passwordstate/resource_list.rb @@ -95,6 +95,13 @@ module Passwordstate def get(id, query = {}) raise 'Operation not supported' unless operation_supported?(:get) + if query.empty? + existing = entries.find do |entry| + entry.send(entry.class.index_field) == id + end + return existing if existing + end + api_path = options.fetch(:get_path, resource.api_path) query = options.fetch(:get_query, {}).merge(query)