Skip to content

Safer tempfiles #1450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor Bug Fix
  • Loading branch information
whokilleddb committed May 27, 2022
commit 76b0e06e847a885ea90e028d20101413a5a5c982
2 changes: 1 addition & 1 deletion git/index/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TemporaryFileSwap(object):

def __init__(self, file_path: PathLike) -> None:
self.file_path = file_path
self.tmp_file_path = tempfile.mktemp("", "", dir=str(self.file_path))
self.tmp_file_path = tempfile.mktemp("", "", dir=str(self.file_path))[1]
# it may be that the source does not exist
try:
os.rename(self.file_path, self.tmp_file_path)
Expand Down