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 28
28
import java .io .IOException ;
29
29
import java .io .InputStream ;
30
30
import java .io .InputStreamReader ;
31
+ import java .io .UnsupportedEncodingException ;
31
32
import java .net .URI ;
32
33
import java .net .URISyntaxException ;
34
+ import java .net .URLDecoder ;
33
35
import java .security .InvalidParameterException ;
34
36
import java .util .ArrayList ;
35
37
import java .util .Arrays ;
@@ -742,7 +744,12 @@ public List<String> getCookieVals(String cookieName) {
742
744
if (cookies != null ) {
743
745
for (int i = cookies .length - 1 ; i >= 0 ; i --) {
744
746
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
+ }
746
753
}
747
754
}
748
755
}
Original file line number Diff line number Diff line change @@ -21,14 +21,16 @@ CDDL HEADER END
21
21
Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
22
22
Portions Copyright 2011 Jens Elkner.
23
23
24
- --%> <%@page import="
24
+ --%>
25
+ <%@page import="
25
26
java.io.BufferedInputStream,
26
27
java.io.BufferedReader,
27
28
java.io.FileInputStream,
28
29
java.io.FileReader,
29
30
java.io.InputStream,
30
31
java.io.InputStreamReader,
31
32
java.io.Reader,
33
+ java.net.URLEncoder,
32
34
java.util.ArrayList,
33
35
java.util.Arrays,
34
36
java.util.List,
@@ -92,8 +94,8 @@ document.pageReady.push(function() { pageReadyList();});
92
94
// update cookie
93
95
cookieValue = cookieValue. length() == 0
94
96
? 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 " ) );
97
99
// TODO hmmm, projects.jspf doesn't set a path
98
100
cookie. setPath(request. getContextPath() + ' /' );
99
101
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]
18
18
19
19
CDDL HEADER END
20
20
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.
22
22
Portions Copyright 2011 Jens Elkner.
23
23
24
- --%><%@page import="
24
+ --%>
25
+ <%@page import="
26
+ java.net.URLEncoder,
25
27
java.util.TreeSet,
26
28
27
29
org.opensolaris.opengrok.web.Prefix,
@@ -40,7 +42,7 @@ org.opensolaris.opengrok.configuration.Project
40
42
41
43
String projects = cfg.getRequestedProjectsAsString();
42
44
if (projects.length() != 0) {
43
- Cookie cookie = new Cookie("OpenGrokProject", projects);
45
+ Cookie cookie = new Cookie("OpenGrokProject", URLEncoder.encode( projects, "utf-8") );
44
46
response.addCookie(cookie);
45
47
}
46
48
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
18
18
19
19
CDDL HEADER END
20
20
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.
22
22
Portions Copyright 2011 Jens Elkner.
23
23
24
24
--%> <%@page session =" false" errorPage =" error.jsp" import="
@@ -69,7 +69,7 @@ include file="projects.jspf"
69
69
} else {
70
70
cfg. setTitle(" Search" );
71
71
}
72
- response. addCookie(new Cookie (" OpenGrokSorting" , searchHelper. order. toString()));
72
+ response. addCookie(new Cookie (" OpenGrokSorting" , URLEncoder . encode( searchHelper. order. toString(), " utf-8 " )));
73
73
% ><% @
74
74
75
75
include file= " httpheader.jspf"
You can’t perform that action at this time.
0 commit comments