Repository navigation
util.py: Fix TypeError when a received path cannot be resolved - #266
Open
Amadeus-22 wants to merge 2 commits into
Open
Amadeus-22 wants to merge 2 commits into
Amadeus-22 wants to merge 2 commits into
Conversation
The RuntimeError branch of test_resolved_path_safety() formatted two placeholders with one argument, so a symlink loop in a transfer raised 'not enough arguments for format string' instead of a ReceiveError.
apply_folder_permissions() logged self.current_path, which is already None at that point, instead of the folder being processed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two small fixes in error reporting while receiving files, one commit each.
util.py – In
test_resolved_path_safety(), theRuntimeErrorbranch isTwo placeholders, one argument.
Path.resolve()raisesRuntimeErroron a symlink loop, which a sender can produce with a symlink entry, so the transfer fails withTypeError: not enough arguments for format stringinstead of aReceiveError, and the error reaches the generic handler instead of theReceiveErrorone. It now passes(unresolved, str(e)), like theValueErrorbranch below it.Checked with a save folder containing
top/loop -> loopandtest_resolved_path_safety("top/loop/x"):transfers.py –
apply_folder_permissions()loggedself.current_pathwhenos.chmodfailed, butclose_current_file()has already set it toNone, so the warning readfolder 'None'. It now logspath, the folder being restored.