junobuild_storage/well_known/
assert.rs1use crate::constants::{WELL_KNOWN_CUSTOM_DOMAINS, WELL_KNOWN_II_ALTERNATIVE_ORIGINS};
2use crate::errors::JUNO_STORAGE_ERROR_RESERVED_ASSET;
3use crate::types::state::FullPath;
4
5pub fn assert_not_well_known_asset(full_path: &FullPath) -> Result<(), String> {
6 assert_not_reserved_path(full_path, WELL_KNOWN_CUSTOM_DOMAINS)?;
8
9 assert_not_reserved_path(full_path, WELL_KNOWN_II_ALTERNATIVE_ORIGINS)?;
11
12 Ok(())
13}
14
15fn assert_not_reserved_path(full_path: &str, reserved_path: &str) -> Result<(), String> {
16 if full_path == reserved_path {
17 return Err(format!(
18 "{JUNO_STORAGE_ERROR_RESERVED_ASSET} ({reserved_path})"
19 ));
20 }
21 Ok(())
22}