File tree Expand file tree Collapse file tree 4 files changed +20
-9
lines changed
src/org/opensolaris/opengrok/web Expand file tree Collapse file tree 4 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 2828import java .io .IOException ;
2929import java .io .InputStream ;
3030import java .io .InputStreamReader ;
31+ import java .io .UnsupportedEncodingException ;
3132import java .net .URI ;
3233import java .net .URISyntaxException ;
34+ import java .net .URLDecoder ;
3335import java .security .InvalidParameterException ;
3436import java .util .ArrayList ;
3537import java .util .Arrays ;
@@ -742,7 +744,12 @@ public List<String> getCookieVals(String cookieName) {
742744 if (cookies != null ) {
743745 for (int i = cookies .length - 1 ; i >= 0 ; i --) {
744746 if (cookies [i ].getName ().equals (cookieName )) {
745- splitByComma (cookies [i ].getValue (), res );
747+ try {
748+ String value = URLDecoder .decode (cookies [i ].getValue (), "utf-8" );
749+ splitByComma (value , res );
750+ } catch (UnsupportedEncodingException ex ) {
751+ log .log (Level .INFO , "decoding cookie failed" , ex );
752+ }
746753 }
747754 }
748755 }
Original file line number Diff line number Diff line change @@ -21,14 +21,16 @@ CDDL HEADER END
2121Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
2222Portions Copyright 2011 Jens Elkner.
2323
24- --%> <%@page import="
24+ --%>
25+ <%@page import="
2526java.io.BufferedInputStream,
2627java.io.BufferedReader,
2728java.io.FileInputStream,
2829java.io.FileReader,
2930java.io.InputStream,
3031java.io.InputStreamReader,
3132java.io.Reader,
33+ java.net.URLEncoder,
3234java.util.ArrayList,
3335java.util.Arrays,
3436java.util.List,
@@ -92,8 +94,8 @@ document.pageReady.push(function() { pageReadyList();});
9294 // update cookie
9395 cookieValue = cookieValue. length() == 0
9496 ? activeProject. getDescription()
95- : activeProject. getDescription() + ' / ' + cookieValue;
96- Cookie cookie = new Cookie (" OpenGrokProject" , cookieValue);
97+ : activeProject. getDescription() + ' , ' + cookieValue;
98+ Cookie cookie = new Cookie (" OpenGrokProject" , URLEncoder . encode( cookieValue, " utf-8 " ) );
9799 // TODO hmmm, projects.jspf doesn't set a path
98100 cookie. setPath(request. getContextPath() + ' /' );
99101 response. addCookie(cookie);
Original file line number Diff line number Diff line change @@ -18,10 +18,12 @@ information: Portions Copyright [yyyy] [name of copyright owner]
1818
1919CDDL HEADER END
2020
21- Copyright (c) 2007, 2010 , Oracle and/or its affiliates. All rights reserved.
21+ Copyright (c) 2007, 2016 , Oracle and/or its affiliates. All rights reserved.
2222Portions Copyright 2011 Jens Elkner.
2323
24- --%><%@page import="
24+ --%>
25+ <%@page import="
26+ java.net.URLEncoder,
2527java.util.TreeSet,
2628
2729org.opensolaris.opengrok.web.Prefix,
@@ -40,7 +42,7 @@ org.opensolaris.opengrok.configuration.Project
4042
4143 String projects = cfg.getRequestedProjectsAsString();
4244 if (projects.length() != 0) {
43- Cookie cookie = new Cookie("OpenGrokProject", projects);
45+ Cookie cookie = new Cookie("OpenGrokProject", URLEncoder.encode( projects, "utf-8") );
4446 response.addCookie(cookie);
4547 }
4648}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
1818
1919CDDL HEADER END
2020
21- Copyright (c) 2005, 2013 , Oracle and/or its affiliates. All rights reserved.
21+ Copyright (c) 2005, 2016 , Oracle and/or its affiliates. All rights reserved.
2222Portions Copyright 2011 Jens Elkner.
2323
2424--%> <%@page session =" false" errorPage =" error.jsp" import="
@@ -69,7 +69,7 @@ include file="projects.jspf"
6969 } else {
7070 cfg. setTitle(" Search" );
7171 }
72- response. addCookie(new Cookie (" OpenGrokSorting" , searchHelper. order. toString()));
72+ response. addCookie(new Cookie (" OpenGrokSorting" , URLEncoder . encode( searchHelper. order. toString(), " utf-8 " )));
7373% ><% @
7474
7575include file= " httpheader.jspf"
You can’t perform that action at this time.
0 commit comments