MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / delete_mod

Function delete_mod

mserver/MasterService/src/http.rs:531–553  ·  view source on GitHub ↗

Delete a published mod (admin-gated): removes its catalog entry and its artifact from the store. 204 on success, 404 if the mod doesn't exist, 401 without a valid admin key.

(
    State(state): State<AppState>,
    headers: HeaderMap,
    Path(mod_id): Path<String>,
)

Source from the content-addressed store, hash-verified

529
530 let name = name.filter(|value| !value.trim().is_empty());
531 if name.is_none() || !file_seen {
532 // Clean up the temp upload, then report the missing field.
533 let _ = state
534 .service
535 .finalize_mod_upload(upload, ModUploadMeta::default())
536 .await;
537 let missing = if name.is_none() { "name" } else { "file" };
538 return Err((
539 StatusCode::BAD_REQUEST,
540 format!("missing '{missing}' field"),
541 ));
542 }
543
544 state
545 .service
546 .finalize_mod_upload(
547 upload,
548 ModUploadMeta {
549 name: name.unwrap(),
550 app_name: app_name.filter(|value| !value.trim().is_empty()),
551 actver: actver.and_then(|value| value.trim().parse().ok()),
552 version_tag: version_tag.filter(|value| !value.trim().is_empty()),
553 version: version.filter(|value| !value.trim().is_empty()),
554 folder_name: folder_name.filter(|value| !value.trim().is_empty()),
555 description: description.filter(|value| !value.is_empty()),
556 authors,

Callers

nothing calls this directly

Calls 4

require_admin_api_keyFunction · 0.85
internal_errorFunction · 0.85
mods_enabledMethod · 0.80
delete_modMethod · 0.45

Tested by

no test coverage detected