Skip reading file size if path name is too long #2215
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The Python os.stat() function below throws an unhandled OSError exception if the file being read's path length exceeds what the OS allows (e.g. 255 on Win7, 1024 on Mac).
vorta/src/vorta/utils.py
Lines 116 to 125 in 0a316e7
Related Issue
fixes #2115
Motivation and Context
Currently, the whole application will crash when estimating backup size if a single file (even if it's excluded) exceeds the maximum length allowed by the OS. PR #2206 addresses excluding files from being calculated as part of the backup size, and this PR ignores files that have an excessive path length.
How Has This Been Tested?
I've run the pytest and pre-commit tests and they have passed.
I'm unable to manually test this as MacOS will not allow me to create a file with a path length exceeding 1024.
Screenshots (if appropriate):
Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.