Fix encoding/decoding of dashboard ids
On server side the dashboard id is encoded/decoded by Url.encode(...)/Url.decode(...), but on client side URL.encodePathSegment(...)/URL.decodePathSegment(...) is used. Both methods to encode/decode work differently and as result dashboards with ids that contain spaces fail to load. Make the encoding/decoding on server and client side consistent and use URL.encode(...)/URL.decode(...) on client side. Change-Id: I5006ff1ad7c16d0cac1c60010658fd3c96433ce5 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -432,8 +432,8 @@ public class Dispatcher {
|
||||
}
|
||||
c = dashboardId.indexOf(":");
|
||||
if (0 <= c) {
|
||||
final String ref = URL.decodePathSegment(dashboardId.substring(0, c));
|
||||
final String path = URL.decodePathSegment(dashboardId.substring(c + 1));
|
||||
final String ref = URL.decode(dashboardId.substring(0, c));
|
||||
final String path = URL.decode(dashboardId.substring(c + 1));
|
||||
DashboardList.get(new Project.NameKey(project), ref + ":" + path, cb);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ public class DashboardList extends NativeList<DashboardInfo> {
|
||||
private static String encodeDashboardId(String dashboardId) {
|
||||
int c = dashboardId.indexOf(":");
|
||||
if (0 <= c) {
|
||||
final String ref = URL.encodePathSegment(dashboardId.substring(0, c));
|
||||
final String path = URL.encodePathSegment(dashboardId.substring(c + 1));
|
||||
final String ref = URL.encode(dashboardId.substring(0, c));
|
||||
final String path = URL.encode(dashboardId.substring(c + 1));
|
||||
return ref + ":" + path;
|
||||
} else {
|
||||
return URL.encodePathSegment(dashboardId);
|
||||
return URL.encode(dashboardId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user