From 9848227c11f3cc4c0ccf6e01d0185c5fda506e80 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 4 Oct 2018 19:06:18 +0300 Subject: fixes found in tests --- juick-server/src/main/java/com/juick/server/api/Service.java | 10 ++++++---- .../src/main/java/com/juick/server/api/activity/Profile.java | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'juick-server/src/main/java/com') diff --git a/juick-server/src/main/java/com/juick/server/api/Service.java b/juick-server/src/main/java/com/juick/server/api/Service.java index c612d3bf..41f05f97 100644 --- a/juick-server/src/main/java/com/juick/server/api/Service.java +++ b/juick-server/src/main/java/com/juick/server/api/Service.java @@ -59,10 +59,12 @@ public class Service { public void processMail(InputStream data) throws Exception { if (UserUtils.getCurrentUser().getName().equals(serviceUser)) { MimeMessage msg = new MimeMessage(session, data); - String returnPath = msg.getHeader("Return-Path")[0]; - logger.info("got msg with return path {}", returnPath); - if (returnPath.equals("<>")) { - return; + String[] returnPaths = msg.getHeader("Return-Path"); + if (returnPaths != null) { + logger.info("got msg with return path {}", returnPaths[0]); + if (returnPaths[0].equals("<>")) { + return; + } } String from = msg.getFrom() == null || msg.getFrom().length > 1 ? ((InternetAddress) msg.getSender()).getAddress() : ((InternetAddress) msg.getFrom()[0]).getAddress(); diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java index a46db7fe..6fdd9d8c 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java @@ -231,10 +231,10 @@ public class Profile { public ResponseEntity processInbox(@RequestBody Activity activity, @RequestHeader(name = "Host") String host, @RequestHeader(name = "Date") String date, - @RequestHeader(name = "Digest") String digest, + @RequestHeader(name = "Digest", required = false) String digest, @RequestHeader(name = "Content-Type") String contentType, - @RequestHeader(name = "User-Agent") String userAgent, - @RequestHeader(name = "Signature") String signature) { + @RequestHeader(name = "User-Agent", required = false) String userAgent, + @RequestHeader(name = "Signature", required = false) String signature) { UriComponents componentsBuilder = ServletUriComponentsBuilder.fromCurrentRequestUri().build(); Map headers = new HashMap<>(); headers.put("host", host); -- cgit v1.2.3