Only store webfinger in cache if returned

main
Bob Mottram 2020-05-07 14:21:58 +01:00
parent 0f1ad061ec
commit 959c1080c7
3 changed files with 10 additions and 9 deletions

View File

@ -6004,7 +6004,6 @@ class PubServer(BaseHTTPRequestHandler):
searchStr = searchStr.replace('+', ' ') searchStr = searchStr.replace('+', ' ')
searchStr = \ searchStr = \
urllib.parse.unquote(searchStr.strip()) urllib.parse.unquote(searchStr.strip())
if self.server.debug:
print('searchStr: ' + searchStr) print('searchStr: ' + searchStr)
if searchForEmoji: if searchForEmoji:
searchStr = ':' + searchStr + ':' searchStr = ':' + searchStr + ':'

View File

@ -44,6 +44,8 @@ def parseHandle(handle: str) -> (str, str):
def webfingerHandle(session, handle: str, httpPrefix: str, def webfingerHandle(session, handle: str, httpPrefix: str,
cachedWebfingers: {}, cachedWebfingers: {},
fromDomain: str, projectVersion: str) -> {}: fromDomain: str, projectVersion: str) -> {}:
"""
"""
if not session: if not session:
print('WARN: No session specified for webfingerHandle') print('WARN: No session specified for webfingerHandle')
return None return None
@ -81,6 +83,8 @@ def webfingerHandle(session, handle: str, httpPrefix: str,
print('params: ' + str(par)) print('params: ' + str(par))
print(e) print(e)
return None return None
if result:
storeWebfingerInCache(nickname + '@' + wfDomain, storeWebfingerInCache(nickname + '@' + wfDomain,
result, cachedWebfingers) result, cachedWebfingers)
return result return result

View File

@ -5846,7 +5846,6 @@ def htmlProfileAfterSearch(recentPostsCache: {}, maxRecentPosts: int,
httpPrefix, wfRequest, httpPrefix, wfRequest,
domain, projectVersion) domain, projectVersion)
if not wf: if not wf:
if debug:
print('DEBUG: Unable to webfinger ' + print('DEBUG: Unable to webfinger ' +
searchNickname + '@' + searchDomainFull) searchNickname + '@' + searchDomainFull)
return None return None
@ -5878,7 +5877,6 @@ def htmlProfileAfterSearch(recentPostsCache: {}, maxRecentPosts: int,
getJson(session, personUrl, asHeader, None, getJson(session, personUrl, asHeader, None,
projectVersion, httpPrefix, domain) projectVersion, httpPrefix, domain)
if not profileJson: if not profileJson:
if debug:
print('DEBUG: No actor returned from ' + personUrl) print('DEBUG: No actor returned from ' + personUrl)
return None return None
avatarUrl = '' avatarUrl = ''