diff options
| author | Thomas Linford <tlinford@users.noreply.github.com> | 2023-10-12 09:55:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-12 09:55:27 +0200 |
| commit | fb1af39acaa6e00c4bee07bafc35c60a7915164e (patch) | |
| tree | e0660105f2b03044cee7ed85a210a10261b5f9c7 /zellij-server/src/plugins/plugin_loader.rs | |
| parent | docs(changelog): plugins security fix (diff) | |
| download | sl0ppij-fb1af39acaa6e00c4bee07bafc35c60a7915164e.tar.gz sl0ppij-fb1af39acaa6e00c4bee07bafc35c60a7915164e.tar.xz sl0ppij-fb1af39acaa6e00c4bee07bafc35c60a7915164e.zip | |
fix(plugins): add zellij version to cached artifact path (#2836)
- move plugin artifact dir to version specific subfolder
- also move stdin-cache file to same subfolder, and use a constant for the path
Diffstat (limited to 'zellij-server/src/plugins/plugin_loader.rs')
| -rw-r--r-- | zellij-server/src/plugins/plugin_loader.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index 3158610b..4d551e38 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -14,6 +14,7 @@ use std::{ use url::Url; use wasmer::{AsStoreRef, Instance, Module, Store}; use wasmer_wasi::{Pipe, WasiState}; +use zellij_utils::consts::ZELLIJ_PLUGIN_ARTIFACT_DIR; use zellij_utils::prost::Message; use crate::{ @@ -521,7 +522,7 @@ impl<'a> PluginLoader<'a> { let (wasm_bytes, cached_path) = self.plugin_bytes_and_cache_path()?; let timer = std::time::Instant::now(); let err_context = || "failed to recover cache dir"; - let module = fs::create_dir_all(ZELLIJ_CACHE_DIR.to_owned()) + let module = fs::create_dir_all(ZELLIJ_PLUGIN_ARTIFACT_DIR.as_path()) .map_err(anyError::new) .and_then(|_| { // compile module @@ -752,7 +753,7 @@ impl<'a> PluginLoader<'a> { .iter() .map(ToString::to_string) .collect(); - let cached_path = ZELLIJ_CACHE_DIR.join(&hash); + let cached_path = ZELLIJ_PLUGIN_ARTIFACT_DIR.join(&hash); self.wasm_blob_on_hd = Some((wasm_bytes.clone(), cached_path.clone())); Ok((wasm_bytes, cached_path)) }, |
