Prevent creation of file named '-'

This commit is contained in:
David Peter authored and David Peter committed 2023-03-15 10:13:58 +01:00
1 parent 5924ac3b63
commit 5f5adda8b4
1 file changed
+2 -3
+2 -3
View File
@@ -79,9 +79,6 @@ impl ExportManager {
/// Add an additional exporter to the ExportManager
pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) -> Result<()> {
let _ = File::create(filename)
.with_context(|| format!("Could not create export file '{}'", filename))?;
let exporter: Box<dyn Exporter> = match export_type {
ExportType::Asciidoc => Box::new(AsciidocExporter::default()),
ExportType::Csv => Box::new(CsvExporter::default()),
@@ -99,6 +96,8 @@ impl ExportManager {
"/dev/stdout".to_string()
}
} else {
let _ = File::create(filename)
.with_context(|| format!("Could not create export file '{}'", filename))?;
filename.to_string()
},
});