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