diff --git a/src/calibre/gui2/actions.py b/src/calibre/gui2/actions.py index 5a3a5a7059..eae4dc76f8 100644 --- a/src/calibre/gui2/actions.py +++ b/src/calibre/gui2/actions.py @@ -927,6 +927,14 @@ class SaveToDiskAction(object): # {{{ _('Choose destination directory')) if not path: return + dpath = os.path.abspath(path).replace('/', os.sep) + lpath = self.library_view.model().db.library_path.replace('/', os.sep) + if dpath.startswith(lpath): + return error_dialog(self, _('Not allowed'), + _('You are tying to save files into the calibre ' + 'library. This can cause corruption of your ' + 'library. Save to disk is meant to export ' + 'files from your calibre library elsewhere.'), show=True) if self.current_view() is self.library_view: from calibre.gui2.add import Saver