From 0bfa08a7ee7e4d41cf9ba08aa1f490156a778a64 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Fri, 20 Jul 2018 10:49:10 +0200 Subject: [PATCH] Prevent tray app from submitting entire drives Fixes #47 --- ATxTray/AutoTxTray.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ATxTray/AutoTxTray.cs b/ATxTray/AutoTxTray.cs index 9759849..5f00eb8 100644 --- a/ATxTray/AutoTxTray.cs +++ b/ATxTray/AutoTxTray.cs @@ -295,6 +295,7 @@ namespace ATxTray return; _selectedDir = new DirectoryInfo(dirDialog.FileName); + Log.Debug($"Selected path from folder picker: [{_selectedDir.Name}]"); var drive = dirDialog.FileName.Substring(0, 3); if (drive != _config.SourceDrive) { MessageBox.Show($@"The selected directory '{_selectedDir}' is required to be on " + @@ -303,6 +304,12 @@ namespace ATxTray return; } + if (_selectedDir.Name.Length <= 3) { + MessageBox.Show($"Submitting entire drives ({_selectedDir.Name}) is not allowed!", + "Invalid selection", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + try { NewTxConfirmationDialog(); } -- GitLab