Download tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/patch.diff from Benchanything/checkerbench: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/patch.diff
- Command line
-
hf download hf://datasets/Benchanything/checkerbench/tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/patch.diff
-
curl -L -o patch.diff https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4/patch.diff
1.25 kB
| diff --git a/thefuck/rules/dirty_untar.py b/thefuck/rules/dirty_untar.py | |
| index d94958b..638aa87 100644 | |
| --- a/thefuck/rules/dirty_untar.py | |
| +++ b/thefuck/rules/dirty_untar.py | |
| def get_new_command(command): | |
| def side_effect(old_cmd, command): | |
| with tarfile.TarFile(_tar_file(old_cmd.script_parts)[0]) as archive: | |
| for file in archive.getnames(): | |
| + if not os.path.abspath(file).startswith(os.getcwd()): | |
| + # it's unsafe to overwrite files outside of the current directory | |
| + continue | |
| + | |
| try: | |
| os.remove(file) | |
| except OSError: | |
| diff --git a/thefuck/rules/dirty_unzip.py b/thefuck/rules/dirty_unzip.py | |
| index 5369dea..6b50798 100644 | |
| --- a/thefuck/rules/dirty_unzip.py | |
| +++ b/thefuck/rules/dirty_unzip.py | |
| def get_new_command(command): | |
| def side_effect(old_cmd, command): | |
| with zipfile.ZipFile(_zip_file(old_cmd), 'r') as archive: | |
| for file in archive.namelist(): | |
| + if not os.path.abspath(file).startswith(os.getcwd()): | |
| + # it's unsafe to overwrite files outside of the current directory | |
| + continue | |
| + | |
| try: | |
| os.remove(file) | |
| except OSError: | |