# HG changeset patch # User Goffi # Date 1458904010 -3600 # Node ID 03f780b60d5d747e527204cd7cc84593de8ac080 # Parent 55a7328fafb6f0ab13da691c1c089dddf01d8409 jp (blog/edit): added forgotten O_TRUNC while opening metadata file diff -r 55a7328fafb6 -r 03f780b60d5d frontends/src/jp/cmd_blog.py --- a/frontends/src/jp/cmd_blog.py Fri Mar 25 11:45:57 2016 +0100 +++ b/frontends/src/jp/cmd_blog.py Fri Mar 25 12:06:50 2016 +0100 @@ -245,7 +245,7 @@ # then we create the file and write metadata there, as JSON dict # XXX: if we port jp one day on Windows, O_BINARY may need to be added here - with os.fdopen(os.open(meta_file_path, os.O_RDWR | os.O_CREAT ,0o600), 'w+b') as f: + with os.fdopen(os.open(meta_file_path, os.O_RDWR | os.O_CREAT | os.O_TRUNC,0o600), 'w+b') as f: # we need to use an intermediate unicode buffer to write to the file unicode without escaping characters unicode_dump = json.dumps(mb_data, ensure_ascii=False, indent=4, separators=(',', ': '), sort_keys=True) f.write(unicode_dump.encode('utf-8'))