diff options
author | Canop <cano.petrole@gmail.com> | 2021-08-01 22:20:49 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-08-01 22:20:49 +0200 |
commit | ff90aed3c0a9c53204639459f742b558a085ec20 (patch) | |
tree | d7ddf06bedf999c578fa640e20def204725b089e /src/app | |
parent | 41846168ebfdf1eeb8f1fef82d692ba894ee4e22 (diff) |
check args are set on external execution
Previously it was possible to have {new_path} as
name of a new file because the argument wasn't filled.
Now the execution is prevented (as was the case in old
versions before a refactoring)
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/panel_state.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/app/panel_state.rs b/src/app/panel_state.rs index 63af80a..bae620f 100644 --- a/src/app/panel_state.rs +++ b/src/app/panel_state.rs @@ -461,9 +461,16 @@ pub trait PanelState { app_state: &mut AppState, cc: &CmdContext, ) -> Result<CmdResult, ProgramError> { + let sel_info = self.sel_info(app_state); + if let Some(invocation) = &invocation { + if let Some(error) = verb.check_args(&sel_info, &invocation, &app_state.other_panel_path) { + debug!("verb.check_args prevented execution: {:?}", &error); + return Ok(CmdResult::error(error)); + } + } let exec_builder = ExecutionStringBuilder::with_invocation( &verb.invocation_parser, - self.sel_info(app_state), + sel_info, app_state, if let Some(inv) = invocation { &inv.args |