From 5b568cab402e683f416db023fc753385caf6712d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 Oct 2016 13:46:32 +0530 Subject: [PATCH] Automatic adding: Show an error if the user specifies a folder whose name starts with a dot or underscore. Fixes #1637021 [Auto adding folder cannot start with a "." period](https://bugs.launchpad.net/calibre/+bug/1637021) --- src/calibre/gui2/preferences/adding.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py index 6adc178dbb..ece361f636 100644 --- a/src/calibre/gui2/preferences/adding.py +++ b/src/calibre/gui2/preferences/adding.py @@ -146,6 +146,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): _('You do not have read/write permissions for ' 'the folder: %s')%path, show=True) raise AbortCommit('invalid auto-add folder') + if os.path.basename(path)[0] in '._': + error_dialog(self, _('Invalid folder'), + _('Cannot use folders whoose names start with a ' + 'period or underscore: %s')%os.path.basename(path), show=True) + raise AbortCommit('invalid auto-add folder') if not question_dialog(self, _('Are you sure?'), _('WARNING: Any files you place in %s will be ' 'automatically deleted after being added to ' @@ -181,4 +186,3 @@ if __name__ == '__main__': from PyQt5.Qt import QApplication app = QApplication([]) test_widget('Import/Export', 'Adding') -