Skip to content
Snippets Groups Projects
Verified Commit e74cb218 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Avoid excessive requests for existing data

parent 3ce045f3
No related branches found
No related tags found
No related merge requests found
Pipeline #5444 passed
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment