Skip to content

Commit 6ce7e4d

Browse files
committed
PR Clone fix
1 parent ea77bd9 commit 6ce7e4d

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
context: .
2929
file: ./Dockerfile
3030
push: true
31-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v8
31+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v10

src/utils/common.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,30 +98,24 @@ pub async fn bulk_check_hash_exists(
9898
mongo_uri: &str,
9999
) -> Result<HashSet<String>, Box<dyn std::error::Error>> {
100100
let client = connect_to_mongodb(mongo_uri, "code-security-open-source").await?;
101-
// let existing_hashes = find_messages_in_hashes(&client, hashes).await?;
102-
// returb blank HashSet if no hashes found
103-
let existing_hashes = HashSet::new();
104-
let blank_hashset = HashSet::new();
105-
if existing_hashes.is_empty() {
106-
return Ok(blank_hashset);
107-
}
101+
let existing_hashes = find_messages_in_hashes(&client, hashes).await?;
108102
Ok(existing_hashes)
109103
}
110104

111105
pub async fn register_hash(message: &str, mongo_uri: &str) {
112106
let hashed_message = hash_text(message);
113-
// match connect_to_mongodb(mongo_uri, "code-security-open-source").await {
114-
// Ok(client) => {
115-
// let collection = client
116-
// .database("code-security-open-source")
117-
// .collection("hashes");
118-
// let document = doc! { "message": hashed_message };
119-
// collection.insert_one(document, None).await.unwrap();
120-
// }
121-
// Err(e) => {
122-
// print_error(&format!("Error: {}", e.to_string()), 101);
123-
// }
124-
// }
107+
match connect_to_mongodb(mongo_uri, "code-security-open-source").await {
108+
Ok(client) => {
109+
let collection = client
110+
.database("code-security-open-source")
111+
.collection("hashes");
112+
let document = doc! { "message": hashed_message };
113+
collection.insert_one(document, None).await.unwrap();
114+
}
115+
Err(e) => {
116+
print_error(&format!("Error: {}", e.to_string()), 101);
117+
}
118+
}
125119
}
126120
pub fn print_error(error: &str, error_code: i32) {
127121
if error.to_lowercase().starts_with("warning") {

0 commit comments

Comments
 (0)