summaryrefslogtreecommitdiffstats
path: root/rust/src/api_entity_crud.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/api_entity_crud.rs')
-rw-r--r--rust/src/api_entity_crud.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/src/api_entity_crud.rs b/rust/src/api_entity_crud.rs
index 2f28e858..792e6f9a 100644
--- a/rust/src/api_entity_crud.rs
+++ b/rust/src/api_entity_crud.rs
@@ -885,6 +885,19 @@ impl EntityCrud for FileEntity {
}
fn db_insert_revs(conn: &DbConn, models: &[&Self]) -> Result<Vec<Uuid>> {
+ // first verify hash syntax
+ for entity in models {
+ if let Some(ref hash) = entity.md5 {
+ check_md5(hash)?;
+ }
+ if let Some(ref hash) = entity.sha1 {
+ check_sha1(hash)?;
+ }
+ if let Some(ref hash) = entity.sha256 {
+ check_sha256(hash)?;
+ }
+ }
+
let rev_ids: Vec<Uuid> = insert_into(file_rev::table)
.values(
models