Skip to content

Commit

Permalink
use already established methods
Browse files Browse the repository at this point in the history
  • Loading branch information
slubwama committed Oct 1, 2024
1 parent a12db13 commit 80656c4
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.util.PrivilegeConstants;
import org.openmrs.web.WebConstants;
import org.openmrs.web.WebUtil;

public class QuickReportServlet extends HttpServlet {

Expand All @@ -71,7 +72,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
return;
}

reportType = sanitizeInput(reportType);
reportType = WebUtil.escapeHTML(reportType);

try {
Velocity.init();
Expand Down Expand Up @@ -362,11 +363,4 @@ private String getTemplate(String reportType) {

return template;
}

private String sanitizeInput(String input) {
if (input == null) {
return null;
}
return input.replaceAll("[<>\"'%;()&+]", "");
}
}

0 comments on commit 80656c4

Please sign in to comment.