Fix for HER-2018: XML representation for /engine/job/<jobName>/beans returns incorrect url for named beans

* JobRelatedResource.java
    Added encoding to URL generation in makePresentableMapFor().
    Added check to prevent URL generation from overwriting the job name portion of the path in addPresentableNestedNames()
This commit is contained in:
Adam Miller
2012-08-31 15:07:31 -07:00
parent 61cbd54059
commit 01be6d4b18
@@ -92,6 +92,9 @@ public abstract class JobRelatedResource extends BaseResource {
}
Reference baseRef = getRequest().getResourceRef().getBaseRef();
if(baseRef.getPath().endsWith("beans"))
baseRef.setPath(baseRef.getPath()+"/");
if (getBeanToNameMap().containsKey(obj)) {
// this object is itself a named bean
@@ -274,7 +277,7 @@ public abstract class JobRelatedResource extends BaseResource {
} else if (beanPathPrefix.endsWith("[")) {
beanPath += field + "]";
}
info.put("url", new Reference(baseRef, "../beans/" + beanPath).getTargetRef());
info.put("url", new Reference(baseRef, "../beans/" + TextUtils.urlEscape(beanPath)).getTargetRef());
}
}
String key = getBeanToNameMap().get(object);