Refuse to add inaccessible folders, warn on inaccessible files during backup (#951)

* Refuse to add inaccessible folders
* Warn when Borg returns a warning (e.g. for inaccessible files)
This commit is contained in:
Manu 2021-04-21 15:15:31 +08:00 committed by GitHub
parent 3b57ab43a4
commit 0e91775091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -32,7 +32,10 @@ class BorgCreateThread(BorgThread):
repo.total_unique_chunks = stats['total_unique_chunks']
repo.save()
self.app.backup_progress_event.emit(self.tr('Backup finished.'))
if result['returncode'] == 1:
self.app.backup_progress_event.emit(self.tr('Backup finished with warnings. See logs for details.'))
else:
self.app.backup_progress_event.emit(self.tr('Backup finished.'))
def progress_event(self, fmt):
self.app.backup_progress_event.emit(fmt)

View File

@ -157,6 +157,12 @@ class SourceTab(SourceBase, SourceUI, BackupProfileMixin):
def receive():
dirs = dialog.selectedFiles()
for dir in dirs:
if not os.access(dir, os.R_OK):
msg = QMessageBox()
msg.setText(self.tr(f"You don't have read access to {dir}."))
msg.exec()
return
new_source, created = SourceFileModel.get_or_create(dir=dir, profile=self.profile())
if created:
self.add_source_to_table(new_source)