|
1 | 1 | use crate::config::get_host_path_from_domain; |
2 | 2 | use crate::file_cache::{CacheItem, FileCache}; |
3 | | -use anyhow::{anyhow, bail, Context}; |
| 3 | +use anyhow::{Context, anyhow, bail}; |
4 | 4 | use dashmap::DashMap; |
5 | 5 | use entity::storage::{ |
6 | 6 | DomainInfo, GetDomainPositionStatus, ShortMetaData, UploadDomainPosition, UploadingStatus, |
@@ -103,16 +103,16 @@ impl DomainStorage { |
103 | 103 | } |
104 | 104 | let path_buf = sub_dir.join(version.to_string()); |
105 | 105 | match domain_version.get_mut(domain_dir_name) { |
106 | | - Some(mut domain_meta) => { |
107 | | - match domain_meta.value_mut() { |
108 | | - DomainMeta::MultipleWeb(ref mut map) => { |
109 | | - map.insert(sub_path.clone(), (path_buf, version)); |
110 | | - } |
111 | | - DomainMeta::OneWeb(..) => { |
112 | | - panic!("init failure, {sub_dir:?} should be multiple web"); |
113 | | - } |
| 106 | + Some(mut domain_meta) => match domain_meta.value_mut() { |
| 107 | + DomainMeta::MultipleWeb(map) => { |
| 108 | + map.insert(sub_path.clone(), (path_buf, version)); |
114 | 109 | } |
115 | | - } |
| 110 | + DomainMeta::OneWeb(..) => { |
| 111 | + panic!( |
| 112 | + "init failure, {sub_dir:?} should be multiple web" |
| 113 | + ); |
| 114 | + } |
| 115 | + }, |
116 | 116 | None => { |
117 | 117 | let map = DashMap::new(); |
118 | 118 | map.insert(sub_path.clone(), (path_buf, version)); |
@@ -833,7 +833,9 @@ mod test { |
833 | 833 | fn test_domain_storage_get_domain_info() { |
834 | 834 | //TODO: fix config path |
835 | 835 | let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../test/config.test.conf"); |
836 | | - env::set_var("SPA_CONFIG", path.display().to_string()); |
| 836 | + unsafe { |
| 837 | + env::set_var("SPA_CONFIG", path.display().to_string()); |
| 838 | + } |
837 | 839 | let mut config = Config::load().unwrap(); |
838 | 840 | config.file_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")) |
839 | 841 | .join("../tests/web/data") |
|
0 commit comments