From 315bbb0ff4cd08fe4d41dc4a72fc9fa86812b162 Mon Sep 17 00:00:00 2001 From: adrianmticarum <38246606+adrianmticarum@users.noreply.github.com> Date: Wed, 23 Oct 2019 11:57:13 +0200 Subject: [PATCH] SAK-42677 - Problems with copy paste of URL's (#7478) Commit to add pages that require info in backing bean (reply, reply all and forward) to the checkUrlRequirements. --- .../MessageForumsFilePickerServlet.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/MessageForumsFilePickerServlet.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/MessageForumsFilePickerServlet.java index 076e8c2d889c..d72060a469b3 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/MessageForumsFilePickerServlet.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/MessageForumsFilePickerServlet.java @@ -23,7 +23,9 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import java.util.ArrayList; import java.util.Enumeration; +import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; @@ -183,8 +185,14 @@ protected void dispatch(HttpServletRequest req, HttpServletResponse res) throws */ private String checkUrlRequirements(HttpServletRequest req, String target) { String newTarget = target; - if ("/privateMsg/pvtMsgDetail".equals(target) && (req.getSession().getAttribute("PrivateMessagesTool") == null || - ((PrivateMessagesTool) req.getSession().getAttribute("PrivateMessagesTool")).getDetailMsg() == null)) { + final List pagesRequireMsgDetailInBean = new ArrayList<>(); + pagesRequireMsgDetailInBean.add("/privateMsg/pvtMsgDetail"); + pagesRequireMsgDetailInBean.add("/pvtMsgReply"); + pagesRequireMsgDetailInBean.add("/pvtMsgReplyAll"); + pagesRequireMsgDetailInBean.add("/pvtMsgForward"); + + final PrivateMessagesTool backingBean = (PrivateMessagesTool) req.getSession().getAttribute("PrivateMessagesTool"); + if (pagesRequireMsgDetailInBean.contains(target) && (backingBean == null || backingBean.getDetailMsg() == null)) { newTarget = "/privateMsg/pvtMsgHpView"; } else if ("/privateMsg/pvtMsgDirectAccess".equals(target)) { final String[] currentMsgDetail = req.getParameterMap().get("current_msg_detail");