diff options
author | 2018-04-26 09:39:49 +0300 | |
---|---|---|
committer | 2018-04-26 09:39:49 +0300 | |
commit | a7825dede977692c0418119159090290e4f6ac34 (patch) | |
tree | 259a07856fc75f1a3c91b4ca169fcbfa0edae551 /juick-www/src/main/java/com/juick/www/controllers | |
parent | 2d8655b5b61cab98f9f53703eb9f8fb8ecb68349 (diff) |
www: fix redirect after command
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/NewMessage.java | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index 83faf3a7..1b3db61d 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -34,7 +34,6 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.util.LinkedMultiValueMap; @@ -51,9 +50,6 @@ import javax.inject.Inject; import java.io.IOException; import java.net.URI; import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; import java.util.stream.Collectors; /** @@ -219,7 +215,6 @@ public class NewMessage { @PostMapping("/post2") public String doPostMessage(@RequestParam(name = "body", required = false) String bodyParam, @RequestParam(required = false) String img, - @RequestParam(required = false) String referer, @RequestParam(required = false) MultipartFile attach) throws JsonProcessingException { com.juick.User visitor = UserUtils.getCurrentUser(); @@ -256,16 +251,13 @@ public class NewMessage { Message newMessage = result.getBody().getNewMessage().orElse(new Message()); if (newMessage.getMid() > 0) { logger.info("/post: {}", jsonMapper.writeValueAsString(result.getBody())); + return String.format("redirect:/%d", newMessage.getMid()); } else { logger.info("{} : {}", body, result.getBody().getText()); } - if (StringUtils.isBlank(referer) || referer.substring(0, 21).equals("http://juick.com/post") - || referer.substring(0, 22).equals("https://juick.com/post")) { - return String.format("redirect:/%d", newMessage.getMid()); - } } catch (HttpClientErrorException e) { logger.error("post error", e); } - return "redirect:" + referer; + return "redirect:/?show=my"; } } |