@@ -13,7 +13,7 @@ async fn upload_firmware(
|
||||
body: web::Bytes,
|
||||
) -> impl Responder {
|
||||
let (device, config, version) = path.into_inner();
|
||||
let version = version.replace(".", "-");
|
||||
let version = version.replace('.', "-");
|
||||
|
||||
let firmware_root_path = &data.firmwares_path;
|
||||
|
||||
@@ -34,8 +34,7 @@ async fn upload_firmware(
|
||||
debug!("{x:?}");
|
||||
|
||||
HttpResponse::Ok().body(format!(
|
||||
"Firmware version {} uploaded successfully",
|
||||
version
|
||||
"Firmware version {version} uploaded successfully"
|
||||
))
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ async fn serve_firmware(
|
||||
data: web::Data<AppState>,
|
||||
) -> impl Responder {
|
||||
let (product, config, version) = path.into_inner();
|
||||
let version = version.replace(".", "-").replace("_", "-");
|
||||
let version = version.replace(['.', '_'], "-");
|
||||
let fw_root_path = &data.firmwares_path;
|
||||
let file_path = PathBuf::from(format!("{product}/firmware_{config}_{version}.bin"));
|
||||
let file_path = fw_root_path.join(&file_path);
|
||||
|
||||
Reference in New Issue
Block a user