From 92dffd266a4ef5a8f78d2ac6ebb74ade23ef5ec6 Mon Sep 17 00:00:00 2001 From: Rh4096 Date: Mon, 10 Jun 2024 17:04:04 +0700 Subject: [PATCH] twerking --- terraps/src/core/asset.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/terraps/src/core/asset.rs b/terraps/src/core/asset.rs index 51aa274..1321b9c 100644 --- a/terraps/src/core/asset.rs +++ b/terraps/src/core/asset.rs @@ -67,7 +67,10 @@ pub async fn get_file(Path(asset): Path) -> Response { } else { read_json(ASSETS_JSON) }; - assets_list[hash].as_array_mut().unwrap().push(json!(name)); + let contains_asset = assets_list[hash].as_array().unwrap().contains(&json!(name)); + if !contains_asset { + assets_list[hash].as_array_mut().unwrap().push(json!(name)); + } write_json(ASSETS_JSON, &assets_list); if config["assets"]["downloadLocally"].as_bool().unwrap() { if !StdPath::new(&path).exists() {