Safer temp file creation

This commit is contained in:
Manuel Ebert 2014-10-21 15:33:28 +02:00
parent 9603f7d3ad
commit 94b53b9247

View file

@ -116,7 +116,7 @@ def load_and_fix_json(json_path):
sys.exit(1)
def get_text_from_editor(config, template=""):
tmpfile = os.path.join(tempfile.mktemp(prefix="jrnl"))
_, tmpfile = os.path.join(tempfile.mkstemp(prefix="jrnl", text=True, suffix=".txt"))
with codecs.open(tmpfile, 'w', "utf-8") as f:
if template:
f.write(template)