Skip to content

Commit

Permalink
check args are set on external execution
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Canop committed Aug 1, 2021
1 parent 4184616 commit ff90aed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### next
- hjson: fix bad parsing on tab alignement
- now check all args of externals are set, doesn't use the raw {arg}

<a name="v1.6.2"></a>
### v1.6.2 - 2021-07-31
Expand Down
9 changes: 8 additions & 1 deletion src/app/panel_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/shell_install/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use {
},
directories::UserDirs,
lazy_regex::regex,
minimad::*,
regex::Captures,
std::{env, fs::OpenOptions, io::Write, path::PathBuf},
termimad::mad_print_inline,
Expand Down
1 change: 0 additions & 1 deletion src/verb/verb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ impl Verb {
return "You can't focus without selection".to_string();
}
}
// TODO check that before
}

let builder = || {
Expand Down

0 comments on commit ff90aed

Please sign in to comment.