mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
fix: shell injection in gitCommit projectDir, test directory cleanup
- gitCommit() now uses double quotes for projectDir consistently with gitPush/gitPull/gitStatus (was single quotes, breaking on paths with apostrophes like "John's Project") - Test suite auto-cleans test_output_formats/ directory via Catch2 event listener after all tests complete (was leaving empty dir)
This commit is contained in:
parent
90142cb0df
commit
961d863f82
2 changed files with 11 additions and 1 deletions
|
|
@ -16,6 +16,16 @@ static void ensureTestDir() {
|
|||
std::filesystem::create_directories(TEST_DIR);
|
||||
}
|
||||
|
||||
static void cleanupTestDir() {
|
||||
std::filesystem::remove_all(TEST_DIR);
|
||||
}
|
||||
|
||||
struct CleanupListener : Catch::EventListenerBase {
|
||||
using EventListenerBase::EventListenerBase;
|
||||
void testRunEnded(const Catch::TestRunStats&) override { cleanupTestDir(); }
|
||||
};
|
||||
CATCH_REGISTER_LISTENER(CleanupListener)
|
||||
|
||||
// ============== WOB Tests ==============
|
||||
|
||||
TEST_CASE("WOB save and load round-trip", "[wob]") {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ bool EditorProject::gitCommit(const std::string& message) const {
|
|||
if (c == '\'' || c == '\\') safe += '\\';
|
||||
safe += c;
|
||||
}
|
||||
int ret = std::system(("cd '" + projectDir + "' && git add -A && "
|
||||
int ret = std::system(("cd \"" + projectDir + "\" && git add -A && "
|
||||
"git commit -m '" + safe + "'").c_str());
|
||||
return ret == 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue