mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
fix mod loading
it was using the wrong path because i broke it :)
This commit is contained in:
@@ -12,7 +12,7 @@ pub fn ensure_path_exists(path: &PathBuf) -> anyhow::Result<()> {
|
||||
/// Joins a parent folder and a sub-path, resolving the subpath beforehand to ensure that
|
||||
/// the resulting path is still within the parent folder, regardless of ".." in the sub-path.
|
||||
pub fn join_path_secure(parent: &Path, sub: &Path) -> anyhow::Result<PathBuf> {
|
||||
Ok(parent.join(sub.canonicalize()?.as_path()))
|
||||
Ok(parent.join(sub.file_name().unwrap_or("".as_ref())))
|
||||
}
|
||||
|
||||
/// Converts a PathBuf into a String in a lossy way. This is generally the way we want to do it
|
||||
|
||||
@@ -229,7 +229,7 @@ impl Client {
|
||||
mod_name.remove(0); // Remove f
|
||||
debug!("Client is requesting file {}", mod_name);
|
||||
|
||||
let client_resources = config.general.get_server_resource_folder()?;
|
||||
let client_resources = config.general.get_client_resource_folder()?;
|
||||
let mod_path = fs_util::join_path_secure(Path::new(&client_resources), Path::new(&mod_name))?;
|
||||
|
||||
if !mod_path.exists() || !mod_path.is_file() {
|
||||
|
||||
Reference in New Issue
Block a user