diff --git a/include/collection_manager.h b/include/collection_manager.h index 0d2d7648..ce8cdb9a 100644 --- a/include/collection_manager.h +++ b/include/collection_manager.h @@ -71,7 +71,7 @@ public: bool auth_key_matches(std::string auth_key_sent); - bool search_only_auth_key_matches(std::string auth_key_sent); + bool search_only_auth_key_matches(const std::string & auth_key_sent); Option create_collection(const std::string name, const std::vector & fields, const std::string & default_sorting_field, diff --git a/src/collection_manager.cpp b/src/collection_manager.cpp index d3ff8e3b..8c070dc0 100644 --- a/src/collection_manager.cpp +++ b/src/collection_manager.cpp @@ -200,8 +200,8 @@ bool CollectionManager::auth_key_matches(std::string auth_key_sent) { return (auth_key == auth_key_sent); } -bool CollectionManager::search_only_auth_key_matches(std::string auth_key_sent) { - return (search_only_auth_key == auth_key_sent); +bool CollectionManager::search_only_auth_key_matches(const std::string & auth_key_sent) { + return !auth_key_sent.empty() && (search_only_auth_key == auth_key_sent); } Option CollectionManager::create_collection(const std::string name, const std::vector & fields,