Use hashes in item ID

This commit is contained in:
bashrc committed 2021-07-27 20:13:55 +01:00
1 parent 13443a914d
commit 303687ba58
2 files changed
+4 -3

No files matched your search

+2 -2
View File
@@ -83,7 +83,7 @@ def getValidSharedItemID(actor: str, displayName: str) -> str:
"""Removes any invalid characters from the display name to
produce an item ID
"""
removeChars = (' ', '\n', '\r')
removeChars = (' ', '\n', '\r', '#')
for ch in removeChars:
displayName = displayName.replace(ch, '')
removeChars2 = ('+', '/', '\\', '?', '&')
@@ -91,7 +91,7 @@ def getValidSharedItemID(actor: str, displayName: str) -> str:
displayName = displayName.replace(ch, '-')
displayName = displayName.replace('.', '_')
displayName = displayName.replace("’", "'")
return actor + '/shareditems/' + displayName
return actor.replace('/', '#') + '#shareditems#' + displayName
def removeSharedItem(baseDir: str, nickname: str, domain: str,
+2 -1
View File
@@ -381,7 +381,8 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int,
ctr = 0
for itemID, item in sharesJson.items():
# assign owner to the item
item['actor'] = itemID.split('/shareditems/')[0]
item['actor'] = \
itemID.split('#shareditems#')[0].replace('#', '/')
allSharesJson[str(item['published'])] = item
ctr += 1
if ctr >= maxSharesPerAccount: