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

more logging!

parent 37c5bda7
No related branches found
No related tags found
No related merge requests found
Pipeline #69 passed with warnings
......@@ -33,14 +33,15 @@ pub async fn delete_file(req: &mut Request, res: &mut Response, depot: &mut Depo
// Grab the file's owner key from the db.
let owner = db::check_owner(sqlconn, filename).await;
debug!("Deletion attempt: user: {} file owner: {:?}", client_key.uuid, owner);
// Compare the client_key and owner.
let authorized = match owner {
Ok(owner_key) => {
debug!("Deletion attempt: user: {} file owner: {:?}", client_key.uuid, owner_key);
client_key.uuid == owner_key
}
Err(_) => false,
};
debug!("authorized: {}", authorized);
// Proceed with deletion if authorized, otherwise respond with an error.
if authorized {
......@@ -75,6 +76,6 @@ pub async fn delete_file(req: &mut Request, res: &mut Response, depot: &mut Depo
// Invalid API Key. The API Exists, but isn't right.
} else {
res.status_code(StatusCode::UNAUTHORIZED);
res.render(Text::Json(r#"{"error": "InvalidAdminKey"}"#));
res.render(Text::Json(r#"{"error": "InvalidAPIKey"}"#));
}
}
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