We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 266b31c commit 1eed458Copy full SHA for 1eed458
soroban-ledger-snapshot/src/lib.rs
@@ -231,6 +231,12 @@ impl LedgerSnapshot {
231
/// If a file already exists at path `p`, it will be replaced.
232
pub fn write_file(&self, p: impl AsRef<Path>) -> Result<(), Error> {
233
let p = p.as_ref();
234
+ if p.is_dir() {
235
+ return Err(Error::Io(std::io::Error::new(
236
+ std::io::ErrorKind::IsADirectory,
237
+ "destination path is a directory",
238
+ )));
239
+ }
240
if let Some(dir) = p.parent() {
241
if !dir.exists() {
242
create_dir_all(dir)?;
0 commit comments