fix: add tags to index files

This commit is contained in:
oSumAtrIX 2023-04-10 07:55:03 +02:00
parent dc1d95d298
commit ba9a868394
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ class ReleaseApi(Api):
# At last join the current tag to an index file # At last join the current tag to an index file
index_path = join(path, f'{repository_name}.json') index_path = join(path, f'{repository_name}.json')
index = read_json(index_path) index = read_json(index_path, [])
if tag not in index: # TODO: Check if there a better way to do this if tag not in index: # TODO: Check if there a better way to do this
index.append(tag) # Add the current tag to the index index.append(tag) # Add the current tag to the index

View File

@ -8,7 +8,7 @@ def write_json(text: str | dict | list, to, overwrite=True):
text = json.dumps(text) text = json.dumps(text)
f.write(text) f.write(text)
def read_json(path, default=[]): def read_json(path, default):
if os.path.exists(path): if os.path.exists(path):
with open(path, 'r') as f: with open(path, 'r') as f:
return json.load(f) return json.load(f)