Only write to indexes once

merge-requests/30/head
Bob Mottram 2020-12-29 17:56:42 +00:00
parent 3554bf1c20
commit cce7941b39
1 changed files with 3 additions and 2 deletions

View File

@ -1979,8 +1979,9 @@ def inboxUpdateIndex(boxname: str, baseDir: str, handle: str,
try: try:
with open(indexFilename, 'r+') as indexFile: with open(indexFilename, 'r+') as indexFile:
content = indexFile.read() content = indexFile.read()
indexFile.seek(0, 0) if destinationFilename + '\n' not in content:
indexFile.write(destinationFilename + '\n' + content) indexFile.seek(0, 0)
indexFile.write(destinationFilename + '\n' + content)
return True return True
except Exception as e: except Exception as e:
print('WARN: Failed to write entry to index ' + str(e)) print('WARN: Failed to write entry to index ' + str(e))