mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 14:48:49 +00:00
Delete NULL bytes from command.script_parts[0]
The byte sequence in command.script_parts[0] can contain one or more '\x00' which will cause os.stat(path) to throw this error: TypeError: must be encoded string without NULL bytes, not str
This commit is contained in:
parent
9192b555b5
commit
c4007f3456
@ -4,7 +4,8 @@ from thefuck.specific.sudo import sudo_support
|
||||
|
||||
@sudo_support
|
||||
def match(command):
|
||||
return command.script_parts and os.path.exists(command.script_parts[0]) \
|
||||
return command.script_parts and os.path.exists(
|
||||
command.script_parts[0].translate(None, '\x00')) \
|
||||
and 'command not found' in command.stderr
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user