From bc91171c654d8d3e5f886a3e67496984a438a116 Mon Sep 17 00:00:00 2001 From: mr-tz Date: Fri, 11 Oct 2024 15:08:01 +0000 Subject: [PATCH] fix bug preventing save of capa results --- CHANGELOG.md | 2 ++ capa/ida/plugin/form.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8368d30a..ab5d9ca24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ ### capa Explorer IDA Pro plugin +- fix bug preventing saving of capa results via Save button @mr-tz + ### Development ### Raw diffs diff --git a/capa/ida/plugin/form.py b/capa/ida/plugin/form.py index 0aee6cea2..028ce2078 100644 --- a/capa/ida/plugin/form.py +++ b/capa/ida/plugin/form.py @@ -1309,10 +1309,17 @@ def save_program_analysis(self): s = self.resdoc_cache.model_dump_json().encode("utf-8") - path = Path(self.ask_user_capa_json_file()) - if not path.exists(): + path = self.ask_user_capa_json_file() + if not path: + # dialog canceled + return + + path = Path(path) + if not path.parent.exists(): + logger.warning("Failed to save file: parent directory '%s' does not exist.", path.parent) return + logger.info("Saving capa results to %s.", path) write_file(path, s) def save_function_analysis(self):