diff --git a/Cargo.lock b/Cargo.lock index be96c50..515368b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1297,9 +1297,9 @@ dependencies = [ [[package]] name = "rbx_asset" -version = "0.4.2" +version = "0.4.3" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "866fc6e4a9ce7cf32148d266c342876eb3f7432bdc09913aff11b032e77e1638" +checksum = "077e2a0b201a777dfd2ff822766ae7d0c8c3003206115da57f7bce15ee73cbc7" dependencies = [ "chrono", "flate2", diff --git a/validation/Cargo.toml b/validation/Cargo.toml index 869b9aa..e30338d 100644 --- a/validation/Cargo.toml +++ b/validation/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" submissions-api = { path = "api", features = ["internal"], default-features = false, registry = "strafesnet" } async-nats = "0.40.0" futures = "0.3.31" -rbx_asset = { version = "0.4.2", registry = "strafesnet" } +rbx_asset = { version = "0.4.3", registry = "strafesnet" } rbx_binary = { version = "0.7.4", registry = "strafesnet"} rbx_dom_weak = { version = "2.9.0", registry = "strafesnet"} rbx_reflection_database = { version = "0.2.12", registry = "strafesnet"} diff --git a/validation/src/create.rs b/validation/src/create.rs index 44acf20..8c99f54 100644 --- a/validation/src/create.rs +++ b/validation/src/create.rs @@ -6,6 +6,7 @@ pub enum Error{ CreatorTypeMustBeUser, ModelInfoDownload(rbx_asset::cloud::GetError), ModelLocationDownload(rbx_asset::cloud::GetError), + NonFreeModel, ModelFileDownload(rbx_asset::cloud::GetError), ParseUserID(core::num::ParseIntError), ParseModelVersion(core::num::ParseIntError), @@ -54,6 +55,11 @@ impl crate::message_handler::MessageHandler{ version:asset_version, }).await.map_err(Error::ModelLocationDownload)?; + // if the location does not exist, you are not allowed to donwload it + let Some(location)=location.location else{ + return Err(Error::NonFreeModel); + }; + // download the map model let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::ModelFileDownload)?; diff --git a/validation/src/upload_mapfix.rs b/validation/src/upload_mapfix.rs index c2abd25..8df288a 100644 --- a/validation/src/upload_mapfix.rs +++ b/validation/src/upload_mapfix.rs @@ -4,6 +4,7 @@ use crate::nats_types::UploadMapfixRequest; #[derive(Debug)] pub enum Error{ GetLocation(rbx_asset::cloud::GetError), + NonFreeModel, Get(rbx_asset::cloud::GetError), Json(serde_json::Error), Upload(rbx_asset::cookie::UploadError), @@ -24,6 +25,11 @@ impl crate::message_handler::MessageHandler{ version:upload_info.ModelVersion, }).await.map_err(Error::GetLocation)?; + // if the location does not exist, you are not allowed to donwload it + let Some(location)=location.location else{ + return Err(Error::NonFreeModel); + }; + // download the map model let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::Get)?; diff --git a/validation/src/upload_submission.rs b/validation/src/upload_submission.rs index d5f85ab..9b9cc50 100644 --- a/validation/src/upload_submission.rs +++ b/validation/src/upload_submission.rs @@ -4,6 +4,7 @@ use crate::nats_types::UploadSubmissionRequest; #[derive(Debug)] pub enum Error{ GetLocation(rbx_asset::cloud::GetError), + NonFreeModel, Get(rbx_asset::cloud::GetError), Json(serde_json::Error), Create(rbx_asset::cookie::CreateError), @@ -25,6 +26,11 @@ impl crate::message_handler::MessageHandler{ version:upload_info.ModelVersion, }).await.map_err(Error::GetLocation)?; + // if the location does not exist, you are not allowed to donwload it + let Some(location)=location.location else{ + return Err(Error::NonFreeModel); + }; + // download the map model let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::Get)?; diff --git a/validation/src/validator.rs b/validation/src/validator.rs index 19eeee0..1a980e9 100644 --- a/validation/src/validator.rs +++ b/validation/src/validator.rs @@ -37,6 +37,7 @@ pub enum Error{ ScriptBlocked(Option<submissions_api::types::ScriptID>), ScriptNotYetReviewed(Option<submissions_api::types::ScriptID>), ModelLocationDownload(rbx_asset::cloud::GetError), + NonFreeModel, ModelFileDownload(rbx_asset::cloud::GetError), ModelFileDecode(ReadDomError), ApiGetScriptPolicyFromHash(submissions_api::types::SingleItemError), @@ -96,6 +97,11 @@ impl crate::message_handler::MessageHandler{ version:validate_info.ModelVersion, }).await.map_err(Error::ModelLocationDownload)?; + // if the location does not exist, you are not allowed to donwload it + let Some(location)=location.location else{ + return Err(Error::NonFreeModel); + }; + // download the map model let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::ModelFileDownload)?;