main
Bob Mottram 2021-07-05 10:55:01 +01:00
parent 8ae7262e9a
commit 3a509400a7
1 changed files with 2 additions and 0 deletions

View File

@ -1334,12 +1334,14 @@ def _deleteHashtagsOnPost(baseDir: str, postJsonObject: {}) -> None:
newlines = ''
for fileLine in lines:
if postId in fileLine:
# skip over the deleted post
continue
newlines += fileLine
if not newlines.strip():
# if there are no lines then remove the hashtag file
os.remove(tagIndexFilename)
else:
# write the new hashtag index without the given post in it
with open(tagIndexFilename, "w+") as f:
f.write(newlines)