Merge pull request #1449 from matthiasbeyer/imag-contact/only-absolute-pathes-on-import

Deny non-absolut import pathes
This commit is contained in:
Matthias Beyer 2018-04-25 11:28:45 +02:00 committed by GitHub
commit 5457834ea1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,6 +178,11 @@ fn import(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("import").unwrap(); // secured by main let scmd = rt.cli().subcommand_matches("import").unwrap(); // secured by main
let path = scmd.value_of("path").map(PathBuf::from).unwrap(); // secured by clap let path = scmd.value_of("path").map(PathBuf::from).unwrap(); // secured by clap
if !path.is_absolute() {
error!("Import path must be absolute. Sorry.");
exit(1)
}
if !path.exists() { if !path.exists() {
error!("Path does not exist"); error!("Path does not exist");
exit(1) exit(1)