Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit eaa6bd7

Browse files
author
sowerstl
committed
Quick Fix addressing potential overwrites if alternate "code_id" exists in autopopulation YAML; (DOECODE-452)
1 parent 764a222 commit eaa6bd7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/gov/osti/services/Metadata.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,14 @@ public Response listProjectsPending(@QueryParam("start") int start,
637637
@Produces ({MediaType.APPLICATION_JSON, "text/yaml"})
638638
public Response autopopulate(@QueryParam("repo") String url,
639639
@QueryParam("format") String format) {
640-
JsonNode result = factory.read(url);
640+
JsonNode resultJson = factory.read(url);
641641

642-
if (null==result)
642+
if (null==resultJson)
643643
return Response.status(Response.Status.NO_CONTENT).build();
644644

645+
ObjectNode result = (ObjectNode) resultJson;
646+
result.remove("code_id");
647+
645648
// if YAML is requested, return that; otherwise, default to JSON output
646649
if ("yaml".equals(format)) {
647650
try {

0 commit comments

Comments
 (0)