aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/www/api/webfinger/Resource.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/com/juick/www/api/webfinger/Resource.java b/src/main/java/com/juick/www/api/webfinger/Resource.java
index 570ceed3..c4e0d5ca 100644
--- a/src/main/java/com/juick/www/api/webfinger/Resource.java
+++ b/src/main/java/com/juick/www/api/webfinger/Resource.java
@@ -46,15 +46,19 @@ public class Resource {
@GetMapping(value = "/.well-known/webfinger", produces = "application/jrd+json;charset=utf-8")
public Account getWebResource(@RequestParam String resource) {
if (resource.startsWith("acct:")) {
- Jid account = Jid.of(resource.substring(5));
- if (account.getDomain().equals(domain)) {
- User user = userService.getUserByName(account.getLocal());
- if (!user.isAnonymous()) {
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUri);
- builder.path(String.format("/u/%s", user.getName()));
- Link blog = new Link("self", ACTIVITY_MEDIA_TYPE, builder.toUriString());
- return new Account(resource, List.of(blog));
+ try {
+ Jid account = Jid.of(resource.substring(5));
+ if (account.getDomain().equals(domain)) {
+ User user = userService.getUserByName(account.getLocal());
+ if (!user.isAnonymous()) {
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUri);
+ builder.path(String.format("/u/%s", user.getName()));
+ Link blog = new Link("self", ACTIVITY_MEDIA_TYPE, builder.toUriString());
+ return new Account(resource, List.of(blog));
+ }
}
+ } catch (NullPointerException | IllegalArgumentException e) {
+ throw new HttpNotFoundException();
}
}
throw new HttpNotFoundException();