1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.web.struts;
17
18 import javax.servlet.http.HttpServletRequest;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.kuali.rice.kns.web.struts.form.KualiForm;
22 import org.kuali.rice.krad.util.KRADConstants;
23
24 public class KualiBatchFileAdminForm extends KualiForm {
25 private String filePath;
26
27
28
29
30 @Override
31 public void populate(HttpServletRequest request) {
32 super.populate(request);
33
34 if (StringUtils.isBlank(getFilePath())&&
35 StringUtils.isNotBlank(request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME)) &&
36 StringUtils.isNotBlank(request.getParameter(KRADConstants.QUESTION_CONTEXT))) {
37 setFilePath(request.getParameter(KRADConstants.QUESTION_CONTEXT));
38 }
39
40 if (filePath != null && filePath.matches(".*\\.\\.[/\\\\].*")) {
41 throw new RuntimeException("Cannot access parent directory");
42 }
43 }
44
45 public String getFilePath() {
46 return filePath;
47 }
48
49 public void setFilePath(String filePath) {
50 this.filePath = filePath;
51 }
52 }