_1password-gui: Fix update-sources.py truncation bug

Update tooling missed to truncate sources.json before or after a
write. Possibly allowing remnant bytes from the older version.
This commit is contained in:
Berk D. Demir
2025-07-04 13:48:14 -07:00
parent 186819cc5d
commit 29bcf2cbd7
@@ -14,14 +14,12 @@ OP_PGP_KEYID = "3FEF9748469ADBE15DA7CA80AC2D62742012EA22"
class Sources(OrderedDict):
def __init__(self):
self._jsonfp = open("sources.json", "r+")
self.update(json.load(self._jsonfp))
self._jsonfp.seek(0, os.SEEK_SET)
with open("sources.json", "r") as fp:
self.update(json.load(fp))
def persist(self):
json.dump(self, self._jsonfp, indent=2)
self._jsonfp.write("\n") # keep fmt.check happy
with open("sources.json", "w") as fp:
print(json.dumps(self, indent=2), file=fp)
class GPG:
def __new__(cls):