Adding chmod step to write_json_file to keep permissions in line with other files such as description, jpg, and annotations.
This is to resolve https://github.com/ytdl-org/youtube-dl/issues/12471 tempfile on linux will make a file that is readonly for the user with all other permission bits turned off. Tempfile is only used for the info.json files. This makes it unique when compared to jpg, annotations, description, and other files that youtube-dl can retrieve or create.
This commit is contained in:
parent
795ea73403
commit
7c58b5148d
@ -27,6 +27,7 @@ import random
|
|||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -1835,6 +1836,12 @@ def write_json_file(obj, fn):
|
|||||||
os.unlink(fn)
|
os.unlink(fn)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
os.chmod(tf.name,
|
||||||
|
stat.S_IRUSR |
|
||||||
|
stat.S_IWUSR |
|
||||||
|
stat.S_IRGRP |
|
||||||
|
stat.S_IROTH)
|
||||||
|
|
||||||
os.rename(tf.name, fn)
|
os.rename(tf.name, fn)
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user