Skip to content
Snippets Groups Projects
Verified Commit 37c5bda7 authored by Volkor Barbarian Warrior's avatar Volkor Barbarian Warrior
Browse files

add debug log for file deletion

parent 8f3a70a2
No related branches found
No related tags found
No related merge requests found
Pipeline #68 passed with warnings
...@@ -24,18 +24,21 @@ pub async fn delete_file(req: &mut Request, res: &mut Response, depot: &mut Depo ...@@ -24,18 +24,21 @@ pub async fn delete_file(req: &mut Request, res: &mut Response, depot: &mut Depo
debug!("Received request to delete file: {}", filename); debug!("Received request to delete file: {}", filename);
// Grab the key from the auth handler. // Grab the user key from the auth handler.
let client_key = depot let client_key = depot
.get::<Key>("client_key") .get::<Key>("client_key")
.expect("Failed to grab API Key from depot") .expect("Failed to grab API Key from depot")
.clone(); .clone();
// Grab they key from the database. // Grab the file's owner key from the db.
let owner = db::check_owner(sqlconn, filename).await; let owner = db::check_owner(sqlconn, filename).await;
// Compare the client_key and owner. // Compare the client_key and owner.
let authorized = match owner { let authorized = match owner {
Ok(owner_key) => client_key.uuid == owner_key, Ok(owner_key) => {
debug!("Deletion attempt: user: {} file owner: {:?}", client_key.uuid, owner_key);
client_key.uuid == owner_key
}
Err(_) => false, Err(_) => false,
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment