forked from indymedia/epicyon
Check that attributedTo is a string
parent
e28327ad97
commit
34798bfd15
2
blog.py
2
blog.py
|
@ -170,6 +170,8 @@ def htmlBlogPostContent(authorized: bool,
|
|||
|
||||
# get the handle of the author
|
||||
if postJsonObject['object'].get('attributedTo'):
|
||||
authorNickname = None
|
||||
if isinstance(postJsonObject['object']['attributedTo'], str):
|
||||
actor = postJsonObject['object']['attributedTo']
|
||||
authorNickname = getNicknameFromActor(actor)
|
||||
if authorNickname:
|
||||
|
|
2
git.py
2
git.py
|
@ -126,6 +126,8 @@ def convertPostToPatch(baseDir: str, nickname: str, domain: str,
|
|||
return False
|
||||
if not postJsonObject['object'].get('attributedTo'):
|
||||
return False
|
||||
if not isinstance(postJsonObject['object']['attributedTo'], str):
|
||||
return False
|
||||
if not isGitPatch(baseDir, nickname, domain,
|
||||
postJsonObject['object']['type'],
|
||||
postJsonObject['object']['summary'],
|
||||
|
|
6
inbox.py
6
inbox.py
|
@ -1422,12 +1422,15 @@ def receiveAnnounce(recentPostsCache: {},
|
|||
# so that their avatar can be shown
|
||||
lookupActor = None
|
||||
if postJsonObject.get('attributedTo'):
|
||||
if isinstance(postJsonObject['attributedTo'], str):
|
||||
lookupActor = postJsonObject['attributedTo']
|
||||
else:
|
||||
if postJsonObject.get('object'):
|
||||
if isinstance(postJsonObject['object'], dict):
|
||||
if postJsonObject['object'].get('attributedTo'):
|
||||
lookupActor = postJsonObject['object']['attributedTo']
|
||||
attrib = postJsonObject['object']['attributedTo']
|
||||
if isinstance(attrib, str):
|
||||
lookupActor = attrib
|
||||
if lookupActor:
|
||||
if '/users/' in lookupActor or \
|
||||
'/channel/' in lookupActor or \
|
||||
|
@ -2190,6 +2193,7 @@ def inboxAfterCapabilities(recentPostsCache: {}, maxRecentPosts: int,
|
|||
postJsonObject['object'].get('summary') and \
|
||||
postJsonObject['object'].get('attributedTo'):
|
||||
attributedTo = postJsonObject['object']['attributedTo']
|
||||
if isinstance(attributedTo, str):
|
||||
fromNickname = getNicknameFromActor(attributedTo)
|
||||
fromDomain, fromPort = getDomainFromActor(attributedTo)
|
||||
if fromPort:
|
||||
|
|
|
@ -3813,6 +3813,7 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
|||
if showIcons:
|
||||
replyToLink = postJsonObject['object']['id']
|
||||
if postJsonObject['object'].get('attributedTo'):
|
||||
if isinstance(postJsonObject['object']['attributedTo'], str):
|
||||
replyToLink += \
|
||||
'?mention=' + postJsonObject['object']['attributedTo']
|
||||
if postJsonObject['object'].get('content'):
|
||||
|
@ -3985,6 +3986,8 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
|||
if showRepeatIcon:
|
||||
if isAnnounced:
|
||||
if postJsonObject['object'].get('attributedTo'):
|
||||
attributedTo = ''
|
||||
if isinstance(postJsonObject['object']['attributedTo'], str):
|
||||
attributedTo = postJsonObject['object']['attributedTo']
|
||||
if attributedTo.startswith(postActor):
|
||||
titleStr += \
|
||||
|
@ -3994,8 +3997,9 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
|||
'" src="/' + iconsDir + \
|
||||
'/repeat_inactive.png" class="announceOrReply"/>\n'
|
||||
else:
|
||||
announceNickname = \
|
||||
getNicknameFromActor(attributedTo)
|
||||
announceNickname = None
|
||||
if attributedTo:
|
||||
announceNickname = getNicknameFromActor(attributedTo)
|
||||
if announceNickname:
|
||||
announceDomain, announcePort = \
|
||||
getDomainFromActor(attributedTo)
|
||||
|
|
Loading…
Reference in New Issue