mirror of
https://github.com/typesense/typesense.git
synced 2025-05-24 07:40:35 +08:00
Fix bug in comparing hashes of files
This commit is contained in:
parent
d8e51ce86a
commit
2517ac0ba7
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user