🏁 Builds on Windows.
parent
865bd1f01f
commit
c4b12eb806
|
@ -109,13 +109,16 @@ async fn serve_file (
|
||||||
)
|
)
|
||||||
-> Result <Response, FileServerError>
|
-> Result <Response, FileServerError>
|
||||||
{
|
{
|
||||||
use std::os::unix::fs::PermissionsExt;
|
|
||||||
|
|
||||||
let file_md = file.metadata ().await.map_err (FileServerError::CantGetFileMetadata)?;
|
let file_md = file.metadata ().await.map_err (FileServerError::CantGetFileMetadata)?;
|
||||||
|
|
||||||
|
#[cfg (unix)]
|
||||||
|
{
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
if file_md.permissions ().mode () == load_toml::CONFIG_PERMISSIONS_MODE
|
if file_md.permissions ().mode () == load_toml::CONFIG_PERMISSIONS_MODE
|
||||||
{
|
{
|
||||||
return Ok (Response::Forbidden);
|
return Ok (Response::Forbidden);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let file_len = file_md.len ();
|
let file_len = file_md.len ();
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ pub fn load_public <
|
||||||
/// For files that may contain secrets and should have permissions or other
|
/// For files that may contain secrets and should have permissions or other
|
||||||
/// safeties checked
|
/// safeties checked
|
||||||
|
|
||||||
|
#[cfg (unix)]
|
||||||
pub fn load <
|
pub fn load <
|
||||||
T: DeserializeOwned,
|
T: DeserializeOwned,
|
||||||
P: AsRef <Path> + Debug
|
P: AsRef <Path> + Debug
|
||||||
|
@ -56,3 +57,15 @@ pub fn load <
|
||||||
|
|
||||||
load_inner (f)
|
load_inner (f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The permission check doesn't work on Windows
|
||||||
|
|
||||||
|
#[cfg (not (unix))]
|
||||||
|
pub fn load <
|
||||||
|
T: DeserializeOwned,
|
||||||
|
P: AsRef <Path> + Debug
|
||||||
|
> (
|
||||||
|
config_file_path: P
|
||||||
|
) -> Result <T, LoadTomlError> {
|
||||||
|
load_public (config_file_path)
|
||||||
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ fn end_to_end () {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
delay_for (Duration::from_millis (500)).await;
|
delay_for (Duration::from_millis (1000)).await;
|
||||||
|
|
||||||
assert_eq! (relay_state.list_servers ().await, vec! [
|
assert_eq! (relay_state.list_servers ().await, vec! [
|
||||||
server_name.to_string (),
|
server_name.to_string (),
|
||||||
|
|
Loading…
Reference in New Issue