Skip to content

Commit

Permalink
MGNL-20935 null / empty / blank
Browse files Browse the repository at this point in the history
  • Loading branch information
ricojansen committed Jul 24, 2023
1 parent e194aa3 commit d8b3ed1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

import org.apache.commons.lang3.StringUtils;

import static java.nio.charset.StandardCharsets.UTF_8;

public class MagnoliaReturnToRequestWrapper extends HttpServletRequestWrapper {
Expand All @@ -18,7 +20,7 @@ public MagnoliaReturnToRequestWrapper(HttpServletRequest request) {
@Override
public String getQueryString() {
String q = super.getQueryString();
if (q == null || q.isEmpty()) {
if (StringUtils.isBlank(q)) {
return FormLogin.PARAMETER_RETURN_TO + "=" + URLEncoder.encode(getRequestURI(), UTF_8);
}
return q + "&" + FormLogin.PARAMETER_RETURN_TO + "=" + URLEncoder.encode(getRequestURI() + "?" + q, UTF_8);
Expand Down

0 comments on commit d8b3ed1

Please sign in to comment.