Can delete uploaded disk images

This commit is contained in:
2025-05-29 08:45:38 +02:00
parent 615dc1ed83
commit 927a51cda7
6 changed files with 89 additions and 11 deletions

View File

@ -132,12 +132,12 @@ pub async fn get_list() -> HttpResult {
}
#[derive(serde::Deserialize)]
pub struct DownloadFilePath {
pub struct IsoFilePath {
filename: String,
}
/// Download ISO file
pub async fn download_file(p: web::Path<DownloadFilePath>, req: HttpRequest) -> HttpResult {
pub async fn download_file(p: web::Path<IsoFilePath>, req: HttpRequest) -> HttpResult {
if !files_utils::check_file_name(&p.filename) {
return Ok(HttpResponse::BadRequest().json("Invalid file name!"));
}
@ -152,7 +152,7 @@ pub async fn download_file(p: web::Path<DownloadFilePath>, req: HttpRequest) ->
}
/// Delete ISO file
pub async fn delete_file(p: web::Path<DownloadFilePath>) -> HttpResult {
pub async fn delete_file(p: web::Path<IsoFilePath>) -> HttpResult {
if !files_utils::check_file_name(&p.filename) {
return Ok(HttpResponse::BadRequest().json("Invalid file name!"));
}