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

feat: Add better logging to add_file fn

parent 81d45ffa
No related branches found
No related tags found
No related merge requests found
use sqlx::{sqlite::SqliteQueryResult, Pool, Sqlite};
use tracing::debug;
use std::{collections::HashMap, time::SystemTime};
/// This struct represents a single file, with a few statistics about said file instance.
......@@ -87,7 +88,7 @@ pub async fn add_file(
)
.execute(sqlconn)
.await?;
tracing::debug!("add_file(Added file to the database.)");
tracing::debug!("[{}] Added {} ({}) to the database", &domain, &file, &mimetype);
Ok(result)
// Will need to add another else if for expiry_override if added later.
}
......@@ -151,7 +152,7 @@ pub async fn check_adminkey(sqlconn: &Pool<Sqlite>, adminkey: &str) -> Result<St
/// This returns the mimetype of the file from the database. line 141 end
/// This is used for serving files, so that we can set the mimetype of unsafe files.
pub async fn get_mimetype(sqlconn: &Pool<Sqlite>, file: &String) -> Result<String, sqlx::Error> {
pub async fn get_mimetype(sqlconn: &Pool<Sqlite>, file: &str) -> Result<String, sqlx::Error> {
let row = sqlx::query!(
"SELECT mimetype FROM files WHERE file = ? AND isDeleted = 0",
file
......@@ -160,6 +161,7 @@ pub async fn get_mimetype(sqlconn: &Pool<Sqlite>, file: &String) -> Result<Strin
.await?;
let mimetype = row.mimetype;
debug!("Mimetype: {}", &mimetype);
Ok(mimetype)
}
......
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