Skip to content

Commit

Permalink
merge mikf#5461: [cookies] use tempfile when saving cookies.txt files
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Apr 13, 2024
2 parents 5227bb6 + 63ac066 commit 0d72789
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gallery_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,11 @@ def cookies_store(self):
if not path:
return

path_tmp = path + ".tmp"
try:
with open(path, "w") as fp:
with open(path_tmp, "w") as fp:
util.cookiestxt_store(fp, self.cookies)
os.replace(path_tmp, path)
except OSError as exc:
self.log.warning("cookies: %s", exc)

Expand Down

0 comments on commit 0d72789

Please sign in to comment.