mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-26 04:32:51 +01:00
Fediverse: Better error on unknown profile.
This commit is contained in:
parent
e87a14826e
commit
70fa18d155
@ -133,7 +133,7 @@ def webfinger(hostname, uri):
|
|||||||
template = _get_webfinger_url(hostname)
|
template = _get_webfinger_url(hostname)
|
||||||
assert template
|
assert template
|
||||||
|
|
||||||
with convert_exceptions(WebfingerError):
|
with convert_exceptions(ActorNotFound):
|
||||||
content = web.getUrlContent(
|
content = web.getUrlContent(
|
||||||
template.replace("{uri}", uri),
|
template.replace("{uri}", uri),
|
||||||
headers={"Accept": "application/json"},
|
headers={"Accept": "application/json"},
|
||||||
|
@ -145,9 +145,9 @@ class Fediverse(callbacks.Plugin):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
actor = ap.get_actor(localuser, hostname)
|
actor = ap.get_actor(localuser, hostname)
|
||||||
except ap.WebfingerError as e:
|
except ap.ActorNotFound as e:
|
||||||
# Usually a 404
|
# Usually a 404
|
||||||
irc.error(e.args[0], Raise=True)
|
irc.error("Unknown user %s." % username, Raise=True)
|
||||||
|
|
||||||
irc.reply(
|
irc.reply(
|
||||||
_("\x02%s\x02 (@%s@%s): %s")
|
_("\x02%s\x02 (@%s@%s): %s")
|
||||||
|
@ -86,5 +86,11 @@ class FediverseTestCase(PluginTestCase):
|
|||||||
# TODO: add a test with an instance which only allows fetches
|
# TODO: add a test with an instance which only allows fetches
|
||||||
# with valid signatures.
|
# with valid signatures.
|
||||||
|
|
||||||
|
def testProfileUnknown(self):
|
||||||
|
self.assertResponse(
|
||||||
|
"profile @nonexistinguser@oc.todon.fr",
|
||||||
|
"Error: Unknown user @nonexistinguser@oc.todon.fr.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
Reference in New Issue
Block a user