diff --git a/plugins/fs/build.rs b/plugins/fs/build.rs index cdb21629..d5cf912c 100644 --- a/plugins/fs/build.rs +++ b/plugins/fs/build.rs @@ -210,10 +210,10 @@ permissions = [ let permission_path = permissions_dir.join(format!("{command}.toml")); let content = std::fs::read_to_string(&permission_path) - .expect(&format!("failed to read {command}.toml")); + .unwrap_or_else(|_| panic!("failed to read {command}.toml")); let mut permission_file = toml::from_str::(&content) - .expect(&format!("failed to deserialize {command}.toml")); + .unwrap_or_else(|_| panic!("failed to deserialize {command}.toml")); for p in permission_file.permission.iter_mut() { p.commands @@ -222,7 +222,7 @@ permissions = [ } let out = toml::to_string_pretty(&permission_file) - .expect(&format!("failed to serialize {command}.toml")); + .unwrap_or_else(|_| panic!("failed to serialize {command}.toml")); let out = format!( r#"# Automatically generated - DO NOT EDIT! @@ -230,6 +230,7 @@ permissions = [ {out}"# ); - std::fs::write(permission_path, out).expect(&format!("failed to write {command}.toml")); + std::fs::write(permission_path, out) + .unwrap_or_else(|_| panic!("failed to write {command}.toml")); } } diff --git a/plugins/fs/guest-js/index.ts b/plugins/fs/guest-js/index.ts index e8619f18..8b62d86a 100644 --- a/plugins/fs/guest-js/index.ts +++ b/plugins/fs/guest-js/index.ts @@ -255,6 +255,7 @@ function fromBytes(buffer: FixedSizeArray): number { const size = bytes.byteLength let x = 0 for (let i = 0; i < size; i++) { + // eslint-disable-next-line security/detect-object-injection const byte = bytes[i] x *= 0x100 x += byte @@ -1045,7 +1046,7 @@ async function writeFile( for await (const chunk of data) { await file.write(chunk) } - file.close() + await file.close() } else { await invoke('plugin:fs|write_file', data, { headers: {