Use hashes in item ID

main
Bob Mottram 2021-07-27 20:13:55 +01:00
parent 13443a914d
commit 303687ba58
2 changed files with 4 additions and 3 deletions

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,

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: