diff --git a/query_modules/CMakeLists.txt b/query_modules/CMakeLists.txt index 022eb8710..7a474a66a 100644 --- a/query_modules/CMakeLists.txt +++ b/query_modules/CMakeLists.txt @@ -25,7 +25,7 @@ install(PROGRAMS $ DESTINATION lib/memgraph/query_modules RENAME example.so) # Also install the source of the example, so user can read it. -install(FILES example.c DESTINATION lib/memgraph/query_modules) +install(FILES example.c DESTINATION lib/memgraph/query_modules/src) # Install the Python example install(FILES example.py DESTINATION lib/memgraph/query_modules RENAME py_example.py) diff --git a/src/query/procedure/module.cpp b/src/query/procedure/module.cpp index 4d0ed6772..899517f41 100644 --- a/src/query/procedure/module.cpp +++ b/src/query/procedure/module.cpp @@ -403,6 +403,10 @@ ModuleRegistry::ModuleRegistry() { bool ModuleRegistry::LoadModuleLibrary(std::filesystem::path path) { std::unique_lock guard(lock_); std::string module_name(path.stem()); + if (path.extension() != ".so" && path.extension() != ".py") { + LOG(WARNING) << "Unknown query module file " << path; + return false; + } if (modules_.find(module_name) != modules_.end()) { LOG(ERROR) << "Unable to overwrite an already loaded module " << path; return false; @@ -418,7 +422,8 @@ bool ModuleRegistry::LoadModuleLibrary(std::filesystem::path path) { if (!loaded) return false; modules_[module_name] = std::move(module); } else { - LOG(ERROR) << "Unknown query module file " << path; + LOG(FATAL) << "Unknown query module extension '" << path.extension() + << "' from file " << path; return false; } return true;