|
32 | 32 | import org.apache.commons.text.StringEscapeUtils; |
33 | 33 | import org.jdom2.DocType; |
34 | 34 | import org.jdom2.Document; |
| 35 | +import org.jdom2.Element; |
35 | 36 | import org.jdom2.JDOMException; |
36 | 37 | import org.jdom2.input.SAXBuilder; |
37 | 38 | import org.jdom2.input.sax.XMLReaders; |
|
58 | 59 | import java.nio.file.Paths; |
59 | 60 | import java.util.*; |
60 | 61 | import java.util.concurrent.ExecutorService; |
61 | | -import java.util.function.Function; |
62 | | -import java.util.stream.Collectors; |
| 62 | +import java.util.concurrent.atomic.AtomicReference; |
63 | 63 |
|
64 | 64 | import static edu.cmu.oli.content.AppUtils.generateUID; |
65 | 65 | import static edu.cmu.oli.content.security.Roles.ADMIN; |
@@ -537,6 +537,17 @@ public Resource doCreate(String packageIdOrGuid, String resourceTypeId, JsonElem |
537 | 537 | JsonObject organization = (JsonObject) ((JsonObject) resourceContent).get("organization"); |
538 | 538 | organization.remove("@id"); |
539 | 539 | organization.addProperty("@id", id); |
| 540 | + JsonArray meta = organization.getAsJsonArray("#array"); |
| 541 | + if(meta!= null){ |
| 542 | + JsonElement icon = null; |
| 543 | + for (JsonElement elem : meta) { |
| 544 | + if (elem.isJsonObject() && elem.getAsJsonObject().has("icon")) { |
| 545 | + icon = elem; |
| 546 | + break; |
| 547 | + } |
| 548 | + } |
| 549 | + meta.remove(icon); |
| 550 | + } |
540 | 551 | resource.setId(id); |
541 | 552 | JsonObject metadata = new JsonObject(); |
542 | 553 | metadata.addProperty("version", "1.0"); |
@@ -593,7 +604,6 @@ public Resource doCreate(String packageIdOrGuid, String resourceTypeId, JsonElem |
593 | 604 |
|
594 | 605 | // Parse update payload into final xml and json documents |
595 | 606 | Map<String, String> contentValues = contentValues(resourceContent, resource, jsonCapable); |
596 | | - |
597 | 607 | validateXmlContent(contentPackage.getGuid(), resource, contentValues.get("xmlContent"), throwErrors); |
598 | 608 |
|
599 | 609 | RevisionBlob revisionBlob = jsonCapable |
|
0 commit comments