Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Fix bug in comparing hashes of files

ozanarmagan2517ac0ba736
diff --git a/src/text_embedder_manager.cpp b/src/text_embedder_manager.cpp
index 0dd3686b..e7e0cf51 100644
--- a/src/text_embedder_manager.cpp
+++ b/src/text_embedder_manager.cpp
@@ -116,8 +116,9 @@ const bool TextEmbedderManager::check_md5(const std::string& file_path, const st
std::stringstream ss,res;
ss << stream.rdbuf();
MD5((unsigned char*)ss.str().c_str(), ss.str().length(), md5);
- for (int i = 0; i < MD5_DIGEST_LENGTH; i++) {
- res << std::hex << (int)md5[i];
+ // convert md5 to hex string with leading zeros
+ for(int i = 0; i < MD5_DIGEST_LENGTH; i++) {
+ res << std::hex << std::setfill('0') << std::setw(2) << (int)md5[i];
}
return res.str() == target_md5;
}